-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
Add (void)
cast
#18115
Add (void)
cast
#18115
Conversation
zend_op *opline; | ||
|
||
zend_do_extended_fcall_begin(); | ||
zend_compile_expr(&expr_node, expr_ast); |
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 guess you could optimize it a bit by not even handling IS_CONSTANT_AST in the first place, i.e. early returning.
I would still keep the IS_CONST handling below though because it generalises.
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.
As with the (void)(bool)
cast, this feels like needless added complexity for a case that is unlikely to happen in practice and also no longer matters once the file is compiled and OPcached.
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.
This is missing support for AST printing in zend_ast.c.
LGTM otherwise.
RFC: https://wiki.php.net/rfc/marking_return_value_as_important
Spun out of #17599, since the
(void)
cast implementation is fully independent of the#[\NoDiscard]
implementation and sufficiently complex on its own, allowing for an easier review.