Skip to content

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

Merged
merged 1 commit into from
Sep 2, 2022

Conversation

nicolas-grekas
Copy link
Contributor

As discussed in #8935
Named after https://php.net/get-called-class

Copy link
Member

@bwoebi bwoebi left a 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?

@cmb69
Copy link
Member

cmb69 commented Aug 16, 2022

Are we fine with adding a public method to an abstract class in a revision release?

@bwoebi
Copy link
Member

bwoebi commented Aug 16, 2022

Given that this method is implemented on the abstract class directly and not abstract, I don't see much risk here.

Copy link
Member

@arnaud-lb arnaud-lb left a 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

@arnaud-lb arnaud-lb merged commit 93f11d8 into php:PHP-8.0 Sep 2, 2022
arnaud-lb added a commit that referenced this pull request Sep 2, 2022
* PHP-8.0:
  [ci skip] NEWS
  Add tests
  Fix GH-8932: Provide a way to get the called-scope of closures (#9299)
arnaud-lb added a commit that referenced this pull request Sep 2, 2022
* PHP-8.1:
  [ci skip] NEWS
  [ci skip] NEWS
  Add tests
  Fix GH-8932: Provide a way to get the called-scope of closures (#9299)
arnaud-lb added a commit that referenced this pull request Sep 2, 2022
* PHP-8.2:
  [ci skip] NEWS
  [ci skip] NEWS
  [ci skip] NEWS
  Add tests
  Fix GH-8932: Provide a way to get the called-scope of closures (#9299)
@@ -48,6 +48,9 @@ public function getClosureThis() {}
/** @return ReflectionClass|null */
public function getClosureScopeClass() {}

/** @return ReflectionClass|null */
public function getClosureCalledClass() {}
Copy link
Member

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.

@nicolas-grekas nicolas-grekas deleted the gh8932 branch December 2, 2022 10:40
nicolas-grekas added a commit to symfony/symfony that referenced this pull request Dec 13, 2022
…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+
symfony-splitter pushed a commit to symfony/error-handler that referenced this pull request Dec 13, 2022
…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+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants