Error warning change idea. Was: Don't silence fatal errors
| From: | Dan Ackroyd | Date: | Thu, 29 Nov 2018 11:24:29 +0000 |
| Subject: | Error warning change idea. Was: Don't silence fatal errors | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-103532@lists.php.net to get a copy of this message | ||
On Thu, 29 Nov 2018 at 09:59, Michał Brzuchalski <michal@brzuchalski.com> wrote:
>
> I don't really know if it fits here but some weeks ago I was thinking about
> annotations with "@" prefix
>....
>
> Which might work as supress all errors except fatal errors.
>
> Does that sound like a solution at all?
> The developer then has full controll on what errors are suppressed or not..
I was thinking along similar lines a while ago:
https://gist.github.com/Danack/5ae0b1b1ce30a0d785dd
The reason I never formally suggested it as an RFC is that I think
it's doubling down on the wrong solution.
The vast majority of places where errors/warning are used currently,
could either be just removed or have the result of the function be
changed to be a tuple of the current result, and an error
flag/message.
[$result, $error] = foo($bar);
if ($error !== null) {
// something went wrong.
}
// $result is usable
cheers
Dan