Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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

Merged
merged 1 commit into from
Jul 6, 2019
Merged

[Messenger] Removes deprecated call to ReflectionType::__toString() on MessengerPass #32398

merged 1 commit into from
Jul 6, 2019

Conversation

volkyeth
Copy link

@volkyeth volkyeth commented Jul 5, 2019

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

@Tobion
Copy link
Contributor

Tobion commented Jul 5, 2019

Should be fixed in 4.2

@derrabus
Copy link
Member

derrabus commented Jul 5, 2019

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()];
Copy link
Contributor

@Tobion Tobion Jul 5, 2019

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

Copy link
Author

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)

@volkyeth
Copy link
Author

volkyeth commented Jul 6, 2019

Is this the only place where we do that cast?

Not sure. That's the only one that triggered the Deprecation notice on my test suite, tough

@volkyeth
Copy link
Author

volkyeth commented Jul 6, 2019

Should be fixed in 4.2

you mean I should retarget this PR to the 4.2 branch?
@Tobion

Should be fixed in 4.2

Do you mean I should retarget this PR to the 4.2 branch or do another one for that one?
This is my first time doing a PR here...not sure how the backports work

@xabbuh xabbuh added this to the 4.2 milestone Jul 6, 2019
@xabbuh
Copy link
Member

xabbuh commented Jul 6, 2019

@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.

@volkyeth volkyeth changed the base branch from 4.3 to 4.2 July 6, 2019 17:58
@volkyeth
Copy link
Author

volkyeth commented Jul 6, 2019

Done ✌️

@Tobion
Copy link
Contributor

Tobion commented Jul 6, 2019

Thank you @brunowowk.

@Tobion Tobion merged commit 0c52a53 into symfony:4.2 Jul 6, 2019
Tobion added a commit that referenced this pull request Jul 6, 2019
…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
@derrabus
Copy link
Member

derrabus commented Jul 6, 2019

This is my first time doing a PR here...

Congratulations on your first contribution. 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants