facebookarchive / pfff

Tools for code analysis, visualizations, or style-preserving source transformation.
http://github.com/facebook/pfff/wiki/Main
Other
2.44k stars 204 forks source link

[spatch] Replacing "||" doesn't work #161

Open aik099 opened 5 years ago

aik099 commented 5 years ago

Hi,

I'm using following spatch file:

-X === null || X === ''
+empty(X)

for a:

<?php

if ( $value === null || $value === '' ) {
    echo 'something';
}

code.

The replacement result is however:

<?php

if ( $value === '' ) {
    echo 'something';
}

instead of

<?php

if ( empty($value) ) {
    echo 'something';
}

Not sure why it's not working. When using sgrep I was able to find that code, but spatch replaces is in non-expected way.

Thanks.