Closed anthonyryan1 closed 2 hours ago
@anthonyryan1 Interesting question, but not something which PHPCS is suitable to ignore.
PHPCS scans are file-based, not project-based, so as soon as the error()
function from the example would be declared in a different file, PHPCS would not be able to determine anymore whether something is a never
function.
I suggest you apply either a // phpcs:ignore PSR2.ControlStructures.SwitchDeclaration.TerminatingComment -- function exits
comment or a PHPStan ignore comment.
Describe the bug
I'm not certain if this is in scope, but I'm curious if phpcs could treat
never
functions as comparable toexit;
Code sample
Custom ruleset
To reproduce
Steps to reproduce the behavior:
test.php
with the code sample above...phpcs test.php ...
regrettably causes the 3rd party project phpstan to rightly throw an error than the break statement is unreachable. So it fixes the phpcs error, and creates a phpstan one. Making it a bit inconvenient.
Versions (please complete the following information)
Additional context
Add any other context about the problem here.
Please confirm:
master
branch of PHP_CodeSniffer.