Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[DI] Save a ReflectionClass instantiation in AutowirePass #21488

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 1, 2017

Conversation

nicolas-grekas
Copy link
Member

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

No behavioral change, just a small refacto that I'm needing for two different PRs I'm working on - will make reviewing them easier also.
Best reviewed by ignoring whitespaces.

@nicolas-grekas nicolas-grekas added this to the 3.3 milestone Feb 1, 2017
@nicolas-grekas nicolas-grekas changed the title [DI] Save a ReflectionClass instanciation in AutowirePass [DI] Save a ReflectionClass instantiation in AutowirePass Feb 1, 2017
@nicolas-grekas nicolas-grekas merged commit b893c72 into symfony:master Feb 1, 2017
nicolas-grekas added a commit that referenced this pull request Feb 1, 2017
…s (nicolas-grekas)

This PR was merged into the 3.3-dev branch.

Discussion
----------

[DI] Save a ReflectionClass instantiation in AutowirePass

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

No behavioral change, just a small refacto that I'm needing for two different PRs I'm working on - will make reviewing them easier also.
Best reviewed by ignoring whitespaces.

Commits
-------

b893c72 [DI] Save a ReflectionClass instanciation in AutowirePass
@nicolas-grekas nicolas-grekas deleted the di-autow-clean branch February 1, 2017 14:24
if ($typeName = $parameter->getType()) {
$typeName = $typeName->isBuiltin() ? null : ($typeName instanceof \ReflectionNamedType ? $typeName->getName() : $typeName->__toString());
}
} elseif (preg_match('/^(?:[^ ]++ ){4}([a-zA-Z_\x7F-\xFF][^ ]++)/', $parameter, $typeName)) {
Copy link
Member

Choose a reason for hiding this comment

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

I would not use $typeName to store the regex matches. Repurposing the same variable name for something else makes the code much harder to read.

Same is true for the output of $parameter->getType() btw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants