Skip to content

[DependencyInjection] Remove static from closures #49474

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
Feb 21, 2023

Conversation

ruudk
Copy link
Contributor

@ruudk ruudk commented Feb 21, 2023

Q A
Branch? 6.3
Bug fix? no
New feature? no
Deprecations? no
Tickets
License MIT
Doc PR

As per request from @nicolas-grekas.

#49472 (comment)

@nicolas-grekas
Copy link
Member

Thank you @ruudk.

@nicolas-grekas nicolas-grekas merged commit 7e2c026 into symfony:6.3 Feb 21, 2023
@ruudk ruudk deleted the remove-static-closures branch February 21, 2023 15:01
@@ -244,7 +244,7 @@ public function dump(array $options = []): string|array
if ($this->addGetService) {
$code = preg_replace(
"/(\r?\n\r?\n public function __construct.+?\\{\r?\n) ++([^\r\n]++)/s",
"\n protected \Closure \$getService;$1 \$containerRef = $2\n \$this->getService = static function () use (\$containerRef) { return \$containerRef->get()->getService(...\\func_get_args()); };",
"\n protected \Closure \$getService;$1 \$containerRef = $2\n \$this->getService = function () use (\$containerRef) { return \$containerRef->get()->getService(...\\func_get_args()); };",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one does not look like a closure being in a static method, as it has $this->getService =

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicolas-grekas Do I need to create a PR to fix this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's needed, here it is: #49476

@@ -1545,7 +1545,7 @@ private function addInlineRequires(bool $hasProxyClasses): string
$code .= "\n include_once __DIR__.'/proxy-classes.php';";
}

return $code ? sprintf("\n \$this->privates['service_container'] = static function (\$container) {%s\n };\n", $code) : '';
return $code ? sprintf("\n \$this->privates['service_container'] = function (\$container) {%s\n };\n", $code) : '';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

ruudk added a commit to ruudk/symfony that referenced this pull request Feb 21, 2023
I removed a bit too much in 9a94e00

As per comment of @stof symfony#49474 (comment)
nicolas-grekas added a commit that referenced this pull request Feb 21, 2023
…ruudk)

This PR was merged into the 6.3 branch.

Discussion
----------

[DependencyInjection] Make some functions static again

| Q             | A
| ------------- | ---
| Branch?       | 6.3
| Bug fix?      |no
| New feature?  |no
| Deprecations? |no
| Tickets       |
| License       | MIT
| Doc PR        |

I removed a bit too much in 9a94e00

As per comment of `@stof` #49474 (comment)

Commits
-------

a9db56d Make some functions static again
symfony-splitter pushed a commit to symfony/dependency-injection that referenced this pull request Feb 21, 2023
I removed a bit too much in 9a94e00c3a64fb9efe142db76d35aff37fb6fa51

As per comment of @stof symfony/symfony#49474 (comment)
symfony-splitter pushed a commit to symfony/dependency-injection that referenced this pull request Feb 21, 2023
…ruudk)

This PR was merged into the 6.3 branch.

Discussion
----------

[DependencyInjection] Make some functions static again

| Q             | A
| ------------- | ---
| Branch?       | 6.3
| Bug fix?      |no
| New feature?  |no
| Deprecations? |no
| Tickets       |
| License       | MIT
| Doc PR        |

I removed a bit too much in 9a94e00c3a64fb9efe142db76d35aff37fb6fa51

As per comment of `@stof` symfony/symfony#49474 (comment)

Commits
-------

a9db56dee3 Make some functions static again
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.

4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy