-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
SCA: minor code tweaks #30653
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
SCA: minor code tweaks #30653
Conversation
kalessil
commented
Mar 22, 2019
•
edited by nicolas-grekas
Loading
edited by nicolas-grekas
Q | A |
---|---|
Branch? | 3.4 |
Bug fix? | no |
New feature? | no |
BC breaks? | no |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | n/a |
License | MIT |
Doc PR | n/a |
- minor code tweaks
- drop private properties, which used as local variables
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.
Thanks!
$hasRun = &$this->hasTerminatedWithException; | ||
$this->exceptionHandler = function (\Exception $e) use ($kernel, $request, &$hasRun) { | ||
if ($hasRun) { | ||
$this->exceptionHandler = function (\Exception $e) use ($kernel, $request) { |
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.
Another option here is to make the closure static
. This would have the benefit of removing a circular reference.
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.
I like the proposal, would you consider enabling static_lambda
CS fixer rule (I have to revert this specific change then)?
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.
please revert and add static
instead yes
dunno about StaticLambdaFixer
- why not :)
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.
Will do + will create a PR for static closures.
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.
BTW which branch to target with static closures, 3.4?
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.
BTW which branch to target with static closures, 3.4?
maybe none: the rule is risky and I'm not sure it makes sense to apply it globally now that I reviewed what it does :)
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.
Got it, but at least you are now aware of it =)
@@ -78,11 +78,7 @@ private function getKernel() | |||
->expects($this->atLeastOnce()) | |||
->method('has') | |||
->will($this->returnCallback(function ($id) { | |||
if ('console.command_loader' === $id) { |
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 applies to 3.4 also - maybe others too? they should be submitted against 3.4
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.
I'll re-check the PR changes against 3.4, thanks for reminding =)
Thank you @kalessil. |
This PR was merged into the 3.4 branch. Discussion ---------- SCA: minor code tweaks | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a - minor code tweaks - drop private properties, which used as local variables Commits ------- cc4529d SCA: minor code tweaks