You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
minor #21488 [DI] Save a ReflectionClass instantiation in AutowirePass (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
Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php
+52-37Lines changed: 52 additions & 37 deletions
Original file line number
Diff line number
Diff line change
@@ -219,54 +219,69 @@ private function autowireMethod(\ReflectionMethod $reflectionMethod, array $argu
219
219
continue;
220
220
}
221
221
222
-
try {
223
-
if (!$typeHint = $parameter->getClass()) {
224
-
// no default value? Then fail
225
-
if (!$parameter->isOptional()) {
226
-
if ($mustAutowire) {
227
-
thrownewRuntimeException(sprintf('Cannot autowire service "%s": argument $%s of method %s::%s() must have a type-hint or be given a value explicitly.', $this->currentId, $parameter->name, $reflectionMethod->class, $reflectionMethod->name));
thrownewRuntimeException(sprintf('Cannot autowire service "%s": argument $%s of method %s::%s() must have a type-hint or be given a value explicitly.', $this->currentId, $parameter->name, $reflectionMethod->class, $reflectionMethod->name));
0 commit comments