чт, 12 сент. 2019 г. в 12:32, Benjamin Morel <benjamin.mo...@gmail.com>:

> >
> > For example when I’m writing a throw-away script, some notices are okay
> to
> > indicate possible problems
>
>
> Maybe it's just me, but even in throw-away scripts, *I've lost much more
> time because of warnings/notices going unnoticed, than I've saved thanks to
> PHP's forgiving nature*.
> Hence even in the shittiest of my scripts, I usually end up registering an
> error handler to throw an exception even for the smallest notice. At least,
> I always get an exception right in my face when something's unexpected, so
> I can fix it and move on, and avoid surprises later on.
>
> Sure, in a quick script, I do see some value in being able to write stuff
> like:
>
>     @ $array['non_existing_key']++;
>
> It's still sloppy though: what you're really doing is muting a notice and
> incrementing null.
> Instead, I feel like there should be a stronger support from the language
> to specifically handle this kind of use cases, rather than using them as a
> justification for not *severely *hardening error reporting.
> I don't think there are that many such *potentially *legitimate use cases,
> so maybe we could just list the use cases and think about a more elegant
> solution to solve them?
>
> In other words, if that was only me, the whole notice/warning stuff would
> go, and PHP would only have exceptions.
> Undefined variables would throw, undefined array keys would throw, and use
> cases like the above would have stronger language support to avoid
> boilerplate code full of if(isset()).
>
> — Benjamin
>

Every single workplace I worked in past 5 years always had 0 tolerance
policy for all notices, warnings and E_STRICT.
Since I started PHP in 2005, I have always worked with a 0
warning/notice/strict tolerance policy, in every workplace I have ever
worked. All those were fixed as bugs, heck even management pointed out
those from logging aggregation and made bugs to be fixed.
At this point, if I see that the company does not do this, I skip it.
Usually, it is a sign of way more stuff being wrong, but this alone is
already enough to have reservations about the advertised position.

The world has moved on how software is developed since the early 2000's
when this was okay. These days, at least in my dev circle, it is not okay
to have notices/warnings in your code.

Reply via email to