-
-
Notifications
You must be signed in to change notification settings - Fork 359
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] Handle nullable extended class on ->isObjectType() on DowngradeReflectionGetAttributesRector #5224
Conversation
… on DowngradeReflectionGetAttributesRector
return $requiredObjectType->isSuperTypeOf($type) | ||
->yes(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TomasVotruba here is the fix, the ->superTypeOf()
must use $requiredObjectType
like used in other method for object type check:
rector-src/packages/NodeTypeResolver/NodeTypeResolver.php
Lines 405 to 411 in 2ad03db
private function isMatchObjectWithoutClassType( | |
ObjectWithoutClassType $objectWithoutClassType, | |
ObjectType $requiredObjectType | |
): bool { | |
if ($objectWithoutClassType instanceof ObjectWithoutClassTypeWithParentTypes) { | |
foreach ($objectWithoutClassType->getParentTypes() as $typeWithClassName) { | |
if ($requiredObjectType->isSuperTypeOf($typeWithClassName)->yes()) { |
All checks have passed 🎉 @TomasVotruba I think it is ready. |
@@ -29,7 +29,7 @@ | |||
new MethodCallRename(DifferentInterface::class, 'renameMe', 'toNewVersion'), | |||
|
|||
// reflection method name | |||
new MethodCallRename(ReflectionMethod::class, 'getTentativeReturnType', 'getReturnType'), | |||
new MethodCallRename(ReflectionFunctionAbstract::class, 'getTentativeReturnType', 'getReturnType'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this for test union: \ReflectionMethod|\ReflectionFunction
which both instanceof ReflectionFunctionAbstract
Line 7 in 2ad03db
public function run(\ReflectionMethod|\ReflectionFunction $reflectionMethod) |
@TomasVotruba I am merging it ;) |
@malteschlueter @TomasVotruba let see if nullable extended class can be checked via
isObjectType()
, refrectorphp/rector-downgrade-php#203 (review)
Closes rectorphp/rector-downgrade-php#203