php-parser icon indicating copy to clipboard operation
php-parser copied to clipboard

"instanceof" and "not" precedence

Open hugues-koolsol opened this issue 10 months ago • 0 comments

Hello First of all, Thank You very much for your work.

I have a little problem with a test combining the not and the instanceof operators :

if( !$stmt instanceof a ){ /* do something */ }

outputs an ast that gives something which is like

if( !($stmt) instanceof a){ /**/ }

and it should give something like

if( !($stmt instanceof a ) ){ /**/ } Because the priority of instanceof is higher than the "not" according to the php documentation there https://www.php.net/manual/en/language.operators.precedence.php

I can go around this little problem but it may be useful to you

Bye & thank you Hugues

hugues-koolsol avatar Jan 19 '25 18:01 hugues-koolsol