You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which shows that short body set hook is expanded to $this->test = strtoupper($value);, not return strtoupper($value);.
But the PropertyHook node does not have access to its property name so we can't construct the correct expression in getStmts().
What would you recommend here? It's easy to work around this problem, but it's a bit misleading about how it works. For example, the set hook always has implicit void return type so it's always wrong to "return" something from it.
The text was updated successfully, but these errors were encountered:
Given short body hooks:
The implementation of
PropertyHook::getStmts()
:Is correct for the get hook, but not for set hook. I consulted this with Ilija (co-author of property hooks) and he showed me this piece of code: https://github.com/php/php-src/blob/6e759e079f882fe54afa6da31f9cc86e9f680bf6/Zend/zend_compile.c#L8492-L8506
Which shows that short body set hook is expanded to
$this->test = strtoupper($value);
, notreturn strtoupper($value);
.But the PropertyHook node does not have access to its property name so we can't construct the correct expression in
getStmts()
.What would you recommend here? It's easy to work around this problem, but it's a bit misleading about how it works. For example, the
set
hook always has implicitvoid
return type so it's always wrong to "return" something from it.The text was updated successfully, but these errors were encountered: