Repository navigation
Conversation
For a list of files, unmatched ignoreErrors entries with a path are not reported, because errors from other files can still match them. So the later rounds of --fix-ignored never saw the baseline entry that matched a fixed ignored error, left it in place, and the next full analysis failed with ignore.unmatched. The rounds already get the files the earlier rounds changed. They are now passed to IgnoredErrorHelperResult::process(), which reports the unmatched entries for those files for a list of files too, so the next round removes them. Entries for other files are still not reported.
10 tasks done
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For a list of files,
--fix-ignoredfixes the ignored errors but leaves the baseline entries that matched them in place, so the next full analysis fails withignore.unmatched. Without paths, the same command removes them (#6909).A list of files is a partial analysis (
onlyFiles), where unmatchedignoreErrorsentries with a path are not reported, because errors from files outside the list can still match them. So the later rounds never saw the entries that the earlier rounds made stale. The rounds already get the files the earlier rounds changed (--fixed-ignored-in), but onlyAnalyseCommandused them, to pick theignore.*errors to fix.They are now passed through
AnalyseApplication::analyse()toIgnoredErrorHelperResult::process(), which reports the unmatched entries for those files for a list of files too, so the next round removes them. Entries for other files are still not reported, and a run without--fixor--fix-ignoreddoesn't change. With--fixalone, the rounds now also remove unmatched entries in the files they changed, like a full run does for all files.This matters for tools that pass the changed files to PHPStan, like git hooks (GrumPHP, CaptainHook).
Tests:
AnalyserTest: an unmatched entry for an analysed file is reported for a list of files only when an earlier fix round changed that file.e2e/fix-ignored-entries: the existing scenario as a list of files, with the same expected result as the full run.Closes phpstan/phpstan#15704