Skip to content

[DependencyInjection] Avoid generating call_user_func in more cases #18682

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

Closed
wants to merge 2 commits into from

Conversation

realityking
Copy link
Contributor

Q A
Branch? master
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
License MIT
Doc PR

This is a follow up to #9807 to add the PHP 5.4 only coded I excluded when I split it off #9432.

@realityking realityking force-pushed the dic_no_call_user branch 2 times, most recently from bb94287 to 9db2a9c Compare April 30, 2016 13:56
@realityking
Copy link
Contributor Author

Not sure what do with the fabbot.io failures as the offending code is in the dumped containers.

@@ -542,6 +542,10 @@ private function addServiceConfigurator($id, $definition, $variableName = 'insta
return sprintf(" %s::%s(\$%s);\n", $this->dumpLiteralClass($class), $callable[1], $variableName);
}

if (strpos($class, 'new') === 0) {
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this check for new (note the trailing space)?

Copy link
Member

Choose a reason for hiding this comment

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

I agree, should be 0 === strpos($class, 'new ')

@nicolas-grekas
Copy link
Member

👍 after @xabbuh's comment is fixed (fabbot failures should be ignored for failures).

@@ -723,6 +727,10 @@ private function addNewInstance(Definition $definition, $return, $instantiation,
return sprintf(" $return{$instantiation}%s::%s(%s);\n", $this->dumpLiteralClass($class), $callable[1], $arguments ? implode(', ', $arguments) : '');
}

if (strpos($class, 'new') === 0) {
Copy link
Member

Choose a reason for hiding this comment

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

0 === strpos($class, 'new ')

@nicolas-grekas
Copy link
Member

ping @realityking

@javiereguiluz
Copy link
Member

@realityking will you have some time to finish this nice pull request adding the minor changes asked by @nicolas-grekas? If not, we can make those minor changes ourselves. Thank you!

There are some circumstances where a Factory or a Configurator causes code using call_user_func is dumped but this hasn't been tested.
@realityking
Copy link
Contributor Author

Sorry, I was distracted and then forgot all about this. Comments addressed, hope Travis runs succeeds this time.

@realityking
Copy link
Contributor Author

Remaning failures are in the generated code.

@nicolas-grekas
Copy link
Member

Thank you @realityking.

nicolas-grekas added a commit that referenced this pull request May 19, 2016
… more cases (realityking)

This PR was submitted for the master branch but it was merged into the 3.0 branch instead (closes #18682).

Discussion
----------

[DependencyInjection] Avoid generating call_user_func in more cases

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

This is a follow up to #9807 to add the PHP 5.4 only coded I excluded when I split it off #9432.

Commits
-------

2718a6c [DependencyInjection] Avoid generating call_user_func in more cases
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.

5 participants