Skip to content
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

Merged
merged 1 commit into from Apr 1, 2019
Merged

SCA: minor code tweaks #30653

merged 1 commit into from Apr 1, 2019

Conversation

kalessil
Copy link
Contributor

@kalessil kalessil commented Mar 22, 2019

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

Copy link
Member

@chalasr chalasr left a 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) {
Copy link
Member

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.

Copy link
Contributor Author

@kalessil kalessil Mar 25, 2019

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)?

Copy link
Member

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 :)

Copy link
Contributor Author

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.

Copy link
Contributor Author

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?

Copy link
Member

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 :)

Copy link
Contributor Author

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) {
Copy link
Member

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

Copy link
Contributor Author

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 =)

@nicolas-grekas nicolas-grekas changed the base branch from 4.2 to 3.4 April 1, 2019 07:06
@nicolas-grekas nicolas-grekas modified the milestones: 4.2, 3.4 Apr 1, 2019
@nicolas-grekas
Copy link
Member

Thank you @kalessil.

@nicolas-grekas nicolas-grekas merged commit cc4529d into symfony:3.4 Apr 1, 2019
nicolas-grekas added a commit that referenced this pull request Apr 1, 2019
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
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.

None yet

4 participants