-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Fix GH-8932: Provide a way to get the called-scope of closures #9299
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
Conversation
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.
Looks good to me. (And I think introducing it in the next bugfix release is the right thing to do.)
I'd like to have another person check whether we want to do this. @arnaud-lb maybe?
Are we fine with adding a public method to an abstract class in a revision release? |
Given that this method is implemented on the abstract class directly and not abstract, I don't see much risk here. |
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.
Looks good to me
@@ -48,6 +48,9 @@ public function getClosureThis() {} | |||
/** @return ReflectionClass|null */ | |||
public function getClosureScopeClass() {} | |||
|
|||
/** @return ReflectionClass|null */ | |||
public function getClosureCalledClass() {} |
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.
The return type could have been declared directly, since it's a brand new function (so there is no BC impact). :) Then there would be no need for the @tentative-return-type
annotation in PHP-8.1.
…rekas) This PR was merged into the 5.4 branch. Discussion ---------- Fix getting the name of closures on PHP 8.1.11+ | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Leverages php/php-src#9299 Commits ------- bccd23d Fix getting the name of closures on PHP 8.1.11+
…rekas) This PR was merged into the 5.4 branch. Discussion ---------- Fix getting the name of closures on PHP 8.1.11+ | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Leverages php/php-src#9299 Commits ------- bccd23d4df Fix getting the name of closures on PHP 8.1.11+
As discussed in #8935
Named after https://php.net/get-called-class