Closed eliashaeussler closed 3 months ago
Just for a reference, the same thing can be achieved with ~30 lines of php code. Example: https://github.com/shipmonk-rnd/phpstan-rules/pull/246/files
Another approach could be to introduce a config parameter that allows for skipping reading of this token. Then PHPStan acts as if the token is not there at all, and thus the error that it tries to hide still shows up. Might even require less code.
Another approach could be to introduce a config parameter that allows for skipping reading of this token.
I like that. Super simple and easy to do. Just one more config param to be passed to PHPStan\Parser\RichParser
. If @ondrejmirtes likes that too, I can implement that.
Not a fan. Less code isn't always better. I'd rather write more code and have the error messages under control.
In my opinion @phpstan-ignore-line
and @phpstan-ignore-next-line
should always work to ignore errors because it's a core feature. But we should report usage of these comments as a new error if the user chooses to.
We already have this information available in AnalyserResult (getLinesToIgnore, getUnmatchedLineIgnores) so it's something that could be easily achieved with a few lines in AnalyserResultFinalizer.
Duplicate of https://github.com/phpstan/phpstan/issues/11340
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Hi,
I built a custom rule in https://github.com/eliashaeussler/phpstan-config/pull/53 that disallows the usage of
@phpstan-ignore-line
and@phpstan-ignore-next-line
annotations without error identifiers.Is this something you'd consider useful as a part of the strict-rules package? If so, I'd be happy to provide a PR. If not, that's fine as well :)
Cheers!