-
-
Notifications
You must be signed in to change notification settings - Fork 371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NodeTypeResolver] Move namespaced name check into specific NameTypeResolver #6093
Conversation
I see. Could you add failing fixture to verify this is needed? |
I will try. |
I added test for existing class short name node short name ac85ebf without this, it will got non existing object type, which actually exists +Rector\StaticTypeMapper\ValueObject\Type\NonExistingObjectType Object #5255 (
+ 'className' => 'AnotherClass', as pointed to |
All checks have passed 🎉 @TomasVotruba I think it is ready. |
I've just release new Rector 1.2.0 with this feature. |
Ref review comment #6089 (comment)
Name
can be a type, and we haveNameTypeResolver
rector-src/src/NodeTypeResolver/NodeTypeResolver/NameTypeResolver.php
Lines 25 to 33 in ef33350
The
namespaced_name
attribute was only working onNullableType
type, thats why PR #5947 added to work recursively to get short name support, eg: alias name, which never be FullyQualified.The
getType()
method works on recursive way in nodes:rector-src/src/NodeTypeResolver/NodeTypeResolver.php
Lines 126 to 129 in ef33350
For
Expr
only, there isgetNativeType()
forExpr
only, but forgetType()
, there is list supported type resolvers:https://github.com/rectorphp/rector-src/tree/main/src/NodeTypeResolver/NodeTypeResolver