Yeah, the issue is with != operator. And that is the reason I'm using strict rules for PHP CodeSniffer. It is based on Slevomat rules and my setting is here github.com/arxeiss/php-coding-stan...
The important one to avoid those issues is this rule
<!-- Disallow use == or != and must use === and !== --><ruleref="SlevomatCodingStandard.Operators.DisallowEqualOperators"/>
Nice that's it. Thanks for sharing your solution to the problem. Do you know if there is something similar to run on CI/CD? or would that just work fine? (I'm not a php dev so I don't know how this works in detail)
Install PHP CodeSniffer github.com/squizlabs/PHP_CodeSniffer with
composer require --dev squizlabs/php_codesniffer or composer require --dev arxeiss/coding-standards to install directly my prepared set of rules.
Prepare your own XML config, sample one is in my repo above too
And then just run ./vendor/bin/phpcs --standard=./phpcs.xml
I think it is invalid code, as
params
hereif(params['pin'] != $user->getPin())
are missing$
in the beginning...Good catch, that was my mistake sorry, it should contain the
$
. I've fixed that, though the bug was not that 😜Yeah, the issue is with
!=
operator. And that is the reason I'm using strict rules for PHP CodeSniffer. It is based on Slevomat rules and my setting is here github.com/arxeiss/php-coding-stan...The important one to avoid those issues is this rule
Nice that's it. Thanks for sharing your solution to the problem. Do you know if there is something similar to run on CI/CD? or would that just work fine? (I'm not a php dev so I don't know how this works in detail)
I'm running this in CI/CD. Basically you
composer require --dev squizlabs/php_codesniffer
orcomposer require --dev arxeiss/coding-standards
to install directly my prepared set of rules../vendor/bin/phpcs --standard=./phpcs.xml
Fantastic easy enough, thanks a lot for the info.