> > Please don't do that either, I don't want to convert > @mkdir("foo"); > to > try { mkdir("foo"); } catch (Exception $e) {} > just to stop my script from exiting if the directory already exists.
What you really want is either another function that does not throw an exception in the specific case of "the directory already exists", or a switch to not throw an exception in this specific case: there might be other reasons that make mkdir() fail, such as a permission error. By blindly silencing mkdir(), *you have no guarantee that the directory will exist after this call is executed*. When mkdir() fails for another reason, I can tell you that *you do want an exception*. Also, some applications might assume that the directory does not already exist, and want to fail if it does. So both use cases must be available in the API. On Thu, 7 Feb 2019 at 10:17, Christian Schneider <cschn...@cschneid.com> wrote: > Am 07.02.2019 um 10:01 schrieb Benjamin Morel <benjamin.mo...@gmail.com>: > > IMO, @ can be safely removed the day PHP converts current warnings to > exceptions. > > Please don't do that either, I don't want to convert > @mkdir("foo"); > to > try { mkdir("foo"); } catch (Exception $e) {} > just to stop my script from exiting if the directory already exists. > > - Chris > >