-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Messenger] Removes deprecated call to ReflectionType::__toString() on MessengerPass #32398
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
[Messenger] Removes deprecated call to ReflectionType::__toString() on MessengerPass #32398
Conversation
Should be fixed in 4.2 |
Is this the only place where we do that cast? |
@@ -221,7 +221,7 @@ private function guessHandledClasses(\ReflectionClass $handlerClass, string $ser | |||
throw new RuntimeException(sprintf('Invalid handler service "%s": type-hint of argument "$%s" in method "%s::__invoke()" must be a class , "%s" given.', $serviceId, $parameters[0]->getName(), $handlerClass->getName(), $type)); | |||
} | |||
|
|||
return [(string) $parameters[0]->getType()]; | |||
return [$parameters[0]->getType()->getName()]; |
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.
it seems getName
only exists on ReflectionNamedType https://www.php.net/manual/en/reflectionnamedtype.getname.php and https://php.net/manual/en/reflectionparameter.gettype.php says it only returns ReflectionType. So getName would not be safe to call here.
But that looks like the php doc is wrong. When the param does not have a type getType
returns null. So getType always returns ReflectionNamedType|null, see https://3v4l.org/W1PUh
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.
That's because currently, ReflectionNamedType is the only subtype of ReflectionType
ref: phpstan/phpstan#1133 (comment)
Not sure. That's the only one that triggered the Deprecation notice on my test suite, tough |
you mean I should retarget this PR to the 4.2 branch?
Do you mean I should retarget this PR to the 4.2 branch or do another one for that one? |
@brunowowk Yes, we always apply bugfixes to the lowest maintained branch where the bug occurs. From there we regularly merge branches up into all other still maintained branches. |
Done ✌️ |
Thank you @brunowowk. |
…oString() on MessengerPass (brunowowk) This PR was merged into the 4.2 branch. Discussion ---------- [Messenger] Removes deprecated call to ReflectionType::__toString() on MessengerPass Closes #32397 | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #32397 | License | MIT | Doc PR | - Removes deprecated call to ReflectionType::__toString() for 7.4 support Commits ------- 0c52a53 Remove call to deprecated method
Congratulations on your first contribution. 😃 |
Closes #32397
Removes deprecated call to ReflectionType::__toString() for 7.4 support