Repository navigation
Conversation
Member
|
Looks like a property equivalent to #6695. |
Member
|
Superseded by #6826 |
ondrejmirtes
added a commit
that referenced
this pull request
Oct 24, 2026
CalledOnTypeUnresolvedPropertyPrototypeReflection replaced every StaticType, GenericStaticType included, with the fetched-on type, so the type arguments written in `@var static<...>` were dropped: on `NodeCursor<BNode>`, a property declared `static<ANode>` was read as `NodeCursor<BNode>`. This handles GenericStaticType like CalledOnTypeUnresolvedMethodPrototypeReflection does for method return types. The bug-15378 regression test comes from #6799. Co-Authored-By: HawkForge <75696486+HawkForge@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011i2xTiyrXgfVkG1tmwMtUM
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#15378
Thanks @LastDragon-ru for the report.
A property declared as
@var static<ANode>in a generic classNodeCursor<TNode>was read asNodeCursor<BNode>|nullwhen fetched onNodeCursor<BNode>: the explicit type argument was lost.CalledOnTypeUnresolvedPropertyPrototypeReflection::transformStaticType()replaced everyStaticType- includingGenericStaticType- with the fetched-on type, so the type arguments written instatic<...>were dropped. Method return types do not have this problem becauseCalledOnTypeUnresolvedMethodPrototypeReflection::transformStaticType()already handlesGenericStaticTypeby changing its base class to the called-on class and taking its static object type.This applies the same
GenericStaticTypehandling to the property prototype; bare@var staticstill resolves to the fetched-on type. The class is shadowed by the turbo extension, so the same change is ported toturbo-ext/src/CalledOnTypeUnresolvedPropertyPrototypeReflection.cpp(mirroring the method-side C++ code).The regression test
tests/PHPStan/Analyser/nsrt/bug-15378.phpis the reproducer from the issue; it fails without the fix (Expected: Bug15378\NodeCursor<Bug15378\ANode>|null, Actual: Bug15378\NodeCursor<Bug15378\BNode>|null) and passes with it, both with and without the turbo extension loaded.