You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unable to inline-ignore errors from most collector-based rules #12328
When a collector-based rule needs data from full codebase, it uses if ($node->isOnlyFilesAnalysis()) return [] (example). But then, you are unable to inline-ignore those errors via // @phpstan-ignore identifier as it produces false-positives in partial analysis of such file (unmatched ignore reported).
You're right here, this isn't easy to solve. Because we're issuing " No error with identifier shipmonk.deadMethod is reported on line 5." error so no CollectedDataNode rule is actually running during that, so we don't see the unmatched ignored error actually comes from a collector.
Activity
mergeable commentedon Dec 27, 2024
This bug report is missing a link to reproduction at phpstan.org/try.
It will most likely be closed after manual review.
ondrejmirtes commentedon Jan 4, 2025
You're right here, this isn't easy to solve. Because we're issuing " No error with identifier shipmonk.deadMethod is reported on line 5." error so no CollectedDataNode rule is actually running during that, so we don't see the unmatched ignored error actually comes from a collector.
janedbal commentedon Jan 23, 2025
If anyone cares, this is solvable by custom formatter, where you list error identifiers of incriminated rules: https://gist.github.com/janedbal/aa11c0b65f05b121e3c8c1ead6b4c6a2
janedbal commentedon Mar 4, 2026
Dead-code-detector "solved" this in shipmonk-rnd/dead-code-detector#292 (and this approach is usable for other identifiers as well).