-
Notifications
You must be signed in to change notification settings - Fork 735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
modernize ErrorException example code #2782
Conversation
IMO the old example should have been set_error_handler(__NAMESPACE__ . "\\exception_error_handler"); so it would work in any namespace, instead of just working in the global namespace, and crash-at-runtime if used in any other namespace, but as of PHP8.1.0 we have an even better way to do it: set_error_handler(exception_error_handler(...));
Co-authored-by: George Peter Banyard <girgias@php.net>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I actually like the variable name changes but that's somewhat whatever
That was actually fixing a consistency issue - other parts of the documentation uses the variable names I switched to here. (Am on phone right now so cba finding out where in the docs, but shouldn't be hard to find) Edit: I think it's the set_error_handler documentation. |
Right, consistency is best. |
Thank you! |
IMO the old example should have been
so it would work in any namespace, because the old example just worked in the global namespace, and crashed-at-runtime if used in any other namespace, but as of PHP8.1.0 we have an even better way to do it: set_error_handler(exception_error_handler(...));