-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[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
Conversation
As per request from @nicolas-grekas. symfony#49472 (comment)
Thank you @ruudk. |
@@ -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()); };", |
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.
this one does not look like a closure being in a static method, as it has $this->getService =
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.
@nicolas-grekas Do I need to create a PR to fix this?
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.
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) : ''; |
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.
same here
I removed a bit too much in 9a94e00 As per comment of @stof symfony#49474 (comment)
…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
I removed a bit too much in 9a94e00c3a64fb9efe142db76d35aff37fb6fa51 As per comment of @stof symfony/symfony#49474 (comment)
…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
As per request from @nicolas-grekas.
#49472 (comment)