-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Use RETURN_THROWS() macro when an exception is thrown #5036
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
Conversation
37039d0
to
8b7bbce
Compare
8b7bbce
to
0dbeed0
Compare
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.
Would be great if we can get this used comprehensively at least for zpp return, to avoid coding style inconsistencies. Will probably take a while until this is used everywhere it should be used...
My plan is to do the migration for ZPP and for some exceptions (after If you agree, I can commit the most straightforward changes directly. |
Yeah, committing those directly is fine. Please add a |
Thanks for the hint, I was actually wondered how to avoid using this macro multiple times in the same code branch. So the final version of |
It would be fairly unusual to return a void value, I'm not sure it's permitted at all. |
Ok, I didn't know it's possible in this form (btw my version also worked for me). |
0dbeed0
to
8b03a4f
Compare
zend_fetch_resource() is another candidate for mass conversion. |
Thanks for the idea! I was about to ask you for suggestions, so feel free to write me should a candidate come to your mind. Would |
@kocsismate Yeah, try_convert_to_string() throws iff it returns null. |
Just one more question: should I also include |
Yes. _ex allows NULL, 2 checks for two resource types (generally persistent + non-persistent). In all cases the deciding factor whether it throws or not is whether the resource name is passed. |
Thanks!
Yep, I noticed this after I finished the migration for |
Let's introduce a macro in order to indicate that an exception was thrown previously as proposed by Nikita in #4994 (review) (Click "Show resolved").
It made sense for me to use this macro even when the exception was thrown one line before, but I can also change them back to normal
return
s.