Repository navigation
Do not analyse stub files with errors when the result cache is restored - #6891
Merged
Merged
Conversation
The errors of the stub validation are kept in the result cache under the stub file. When a new file appeared, every file with errors was re-analysed, the stub file too, so the rules for analysed files reported errors in it, such as a missing return statement in each method without a body. Amp-Thread-ID: https://ampcode.com/threads/T-01a18c38-cedb-76c4-8a09-c5e85fea5b60
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.
The errors that the stub validation reports are kept in the result cache under the stub file, and restored with it. When a new analysed file appears, or the symbols of a file that is not analysed change, every file with errors is re-analysed — and the stub file was one of them. It was then analysed like a project file, so the rules for analysed files reported errors in it, such as a missing return statement in each method that has a return type and no body. Those errors were then cached too.
It needs a stub file outside the vendor directory with an error from the stub validation, a cache from a full analysis, and a new file:
Method Foo::doFoo() has parameter $a with no type specified.Method Foo::doFoo() should return string but return statement is missing.Found with TwigStan, which creates new compiled templates on most runs: after an update, its own
CoreExtension.stub, installed from a path repository, reported 145 errors in a warm run and none in a cold one.The stub files are now skipped when the files with errors are re-analysed. They keep their errors from the stub validation, which runs again when a stub file changes, because that discards the result cache.
The e2e test
result-cache-stub-files-errorsfails without the change.