Rework phpDoc inheritance to resolve through reflection instead of re-walking the hierarchy#4829
Merged
ondrejmirtes merged 3 commits into2.1.xfrom Jan 30, 2026
Merged
Conversation
a5cbeeb to
687df1e
Compare
Collaborator
|
This pull request has been marked as ready for review. |
515a43d to
2452137
Compare
spaze
added a commit
to spaze/phpstan-disallowed-calls
that referenced
this pull request
Jan 31, 2026
PHPStan 2.1.38 have started adding the types, so instead of e.g. `PhpOption\Option` we got `PhpOption\Option<mixed>` and that didn't match with the configured class for a disallowed constant, causing `ClassConstantUsagesTest` to fail. I think the change was introduced in phpstan/phpstan-src#4829 because if you look at the changed files, you'll see a lot of `->getDisplayName()` => `->getDisplayName(false)`.
spaze
added a commit
to spaze/phpstan-disallowed-calls
that referenced
this pull request
Jan 31, 2026
…me (#363) PHPStan 2.1.38 have started adding the types, so instead of e.g. `PhpOption\Option` we got `PhpOption\Option<mixed>` and that didn't match with the configured class for a disallowed constant, causing `ClassConstantUsagesTest` to fail. I think the change was introduced in phpstan/phpstan-src#4829 because if you look at the changed files, you'll see a lot of `->getDisplayName()` => `->getDisplayName(false)`.
mglaman
added a commit
to mglaman/phpstan-src
that referenced
this pull request
Feb 20, 2026
NodeScopeResolver::getPhpDocs() was only consulting FileTypeMapper (the source file's phpDoc) when resolving parameter types inside method bodies, never checking StubPhpDocProvider for stub overrides. This was a regression introduced in 2.1.38 by PR phpstan#4829, which rewrote PhpDocInheritanceResolver::resolvePhpDocForMethod() and removed the PhpDocBlock::docBlockToResolvedDocBlock() helper that previously called StubPhpDocProvider::findMethodPhpDoc() first. The fix mirrors the pre-regression behaviour: consult StubPhpDocProvider before falling back to FileTypeMapper in the ClassMethod phpDoc resolution path of getPhpDocs(). Fixes phpstan/phpstan#14118 Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
3 tasks
mglaman
added a commit
to mglaman/phpstan-src
that referenced
this pull request
Feb 20, 2026
NodeScopeResolver::getPhpDocs() was only consulting FileTypeMapper (the source file's phpDoc) when resolving parameter types inside method bodies, never checking StubPhpDocProvider for stub overrides. This was a regression introduced in 2.1.38 by PR phpstan#4829, which rewrote PhpDocInheritanceResolver::resolvePhpDocForMethod() and removed the PhpDocBlock::docBlockToResolvedDocBlock() helper that previously called StubPhpDocProvider::findMethodPhpDoc() first. The fix mirrors the pre-regression behaviour: consult StubPhpDocProvider before falling back to FileTypeMapper in the ClassMethod phpDoc resolution path of getPhpDocs(). Fixes phpstan/phpstan#14118 Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
3 tasks
mglaman
added a commit
to mglaman/phpstan-drupal
that referenced
this pull request
Feb 25, 2026
PHPStan 2.1.38+ reworked phpDoc inheritance to resolve through reflection instead of re-walking the hierarchy (phpstan/phpstan-src#4829). This causes @deprecated annotations on EntityStorageInterface::loadRevision to propagate through the full class/interface hierarchy, bypassing the RevisionableStorageInterface stub that was supposed to suppress false positives. The test no longer validates the stub's intended behavior, so remove it and the associated data fixture. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2 tasks
mglaman
added a commit
to mglaman/phpstan-drupal
that referenced
this pull request
Feb 25, 2026
Remove RevisionableStorageInterfaceStubTest (#941) PHPStan 2.1.38+ reworked phpDoc inheritance to resolve through reflection instead of re-walking the hierarchy (phpstan/phpstan-src#4829). This causes @deprecated annotations on EntityStorageInterface::loadRevision to propagate through the full class/interface hierarchy, bypassing the RevisionableStorageInterface stub that was supposed to suppress false positives. The test no longer validates the stub's intended behavior, so remove it and the associated data fixture. Co-authored-by: Claude Sonnet 4.6 <[email protected]>
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.
Closes phpstan/phpstan#10771
These changes make PhpDocInheritanceResolver completely disappear from the Blackfire profile:
There are some failing tests but I created a PR so I can look at diffs comfortably and implement again what I deleted.