kokororin / vscode-phpfmt

Integrates phpfmt into VS Code
https://marketplace.visualstudio.com/items?itemName=kokororin.vscode-phpfmt
BSD 3-Clause "New" or "Revised" License
129 stars 30 forks source link

"ReplaceIsNull" is adding a bug to my code #154

Closed adrianahdez closed 1 month ago

adrianahdez commented 1 month ago

Hi,

This block normally return true as it is:

function get_number() {
    return '334';
}

if ( !is_null( $n = get_number() ) ) {
    // do something with $n...
    var_dump(true);
} else {
    var_dump(false);
}

And the "ReplaceIsNull" option is changing that if() statement to this:

if ( !null === $n = get_number() ) { ... }

Which is wrong, because it's returning false and it's adding a bug to the code.

In this case, it should be changed to this, in order to work fine:

if ( null !== $n = get_number() ) { ...}

driade commented 1 month ago

This one was easy, fixed in the latest version

adrianahdez commented 1 month ago

oh, that was fast. Many thanks :)