Skip to content

Raise Squiz.PHP.NonExecutableCode to error #204

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: 8.2.x
Choose a base branch
from

Conversation

gmponos
Copy link
Contributor

@gmponos gmponos commented Jun 19, 2020

Not sure if this was on purpose.

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

@gmponos gmponos requested a review from a team as a code owner June 19, 2020 09:50
@greg0ire
Copy link
Member

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?

@gmponos
Copy link
Contributor Author

gmponos commented Jun 19, 2020

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..

@SenseException
Copy link
Member

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.

@greg0ire greg0ire changed the base branch from master to 8.2.x October 25, 2020 10:06
@greg0ire greg0ire requested a review from a team April 3, 2021 11:14
@greg0ire
Copy link
Member

greg0ire commented Apr 3, 2021

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

Copy link
Member

@Ocramius Ocramius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO requires major anyway, still LGTM

@derrabus
Copy link
Member

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

@Ocramius
Copy link
Member

Works too 👍

@jrfnl
Copy link
Contributor

jrfnl commented May 4, 2023

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.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants