coding-standard icon indicating copy to clipboard operation
coding-standard copied to clipboard

Raise Squiz.PHP.NonExecutableCode to error

Open gmponos opened this issue 4 years ago • 7 comments

Not sure if this was on purpose.

This rules is intent to throw a warning and not an error.

gmponos avatar Jun 19 '20 09:06 gmponos

This rules is intent to throw a warning and not an error.

Are you saying that the intent is wrong? If yes, why not report that upstream instead?

greg0ire avatar Jun 19 '20 10:06 greg0ire

No no... I think the intent of Squiz.PHP.NonExecutableCode is what it is..

Not sure if doctrine org intentions was to have it as a warning or if you just missed that.. If this rule is added to doctrine standard as a warning on purpose then we can close this..

gmponos avatar Jun 19 '20 10:06 gmponos

I don't know if this was intended to be a warning, but I like to have an error here for NonExecutableCode. It had a few false positives in the past and maybe that's why it's a warning, but if this isn't an issue anymore, then an error would be fine.

SenseException avatar Jun 20 '20 13:06 SenseException

Not sure about the target branch… is this really a bugfix?

greg0ire avatar Apr 03 '21 11:04 greg0ire

Maybe we should consider removing the rule completely. It produces false positives for throw expressions in PHP 8 and PHPStan/Psalm should have a better dead code detection.

see squizlabs/PHP_CodeSniffer#2857

derrabus avatar Feb 15 '22 08:02 derrabus

Works too 👍

Ocramius avatar Feb 15 '22 08:02 Ocramius

Maybe we should consider removing the rule completely. It produces false positives for throw expressions in PHP 8 and PHPStan/Psalm should have a better dead code detection.

see squizlabs/PHP_CodeSniffer#2857

FYI: The above mentioned issues have been fixed and the fixes will be included in PHPCS 3.8.0.

jrfnl avatar May 04 '23 16:05 jrfnl