10000 minor #60079 [HttpKernel] Remove always-true condition on existence o… · symfony/symfony@d442a43 · GitHub
[go: up one dir, main page]

Skip to content

Commit d442a43

Browse files
committed
minor #60079 [HttpKernel] Remove always-true condition on existence of DI Autowire class (GromNaN)
This PR was merged into the 7.3 branch. Discussion ---------- [HttpKernel] Remove always-true condition on existence of DI `Autowire` class | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | - | License | MIT This condition was introduced in #45657 The class `RegisterControllerArgumentLocatorsPass` requires the DI component, which cannot be < 6.4 due to a [conflict rule in composer.json](https://github.com/symfony/symfony/blob/79ea49c772ce4b39f414cde5648ad347c3bbcfd7/src/Symfony/Component/HttpKernel/composer.json#L33). So the `Autoconfigure` class always exists. Commits ------- 3975043 Remove always-true condition
2 parents 79ea49c + 3975043 commit d442a43

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/Symfony/Component/HttpKernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ public function process(ContainerBuilder $container): void
5151
}
5252
}
5353

54-
$emptyAutowireAttributes = class_exists(Autowire::class) ? null : [];
55-
5654
foreach ($container->findTaggedServiceIds('controller.service_arguments', true) as $id => $tags) {
5755
$def = $container->getDefinition($id);
5856
$def->setPublic(true);
@@ -129,7 +127,7 @@ public function process(ContainerBuilder $container): void
129127
/** @var \ReflectionParameter $p */
130128
$type = preg_replace('/(^|[(|&])\\\\/', '\1', $target = ltrim(ProxyHelper::exportType($p) ?? '', '?'));
131129
$invalidBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE;
132-
$autowireAttributes = $autowire ? $emptyAutowireAttributes : [];
130+
$autowireAttributes = null;
133131
$parsedName = $p->name;
134132
$k = null;
135133

@@ -155,7 +153,7 @@ public function process(ContainerBuilder $container): void
155153
$args[$p->name] = $bindingValue;
156154

157155
continue;
158-
} elseif (!$autowire || (!($autowireAttributes ??= $p->getAttributes(Autowire::class, \ReflectionAttribute::IS_INSTANCEOF)) && (!$type || '\\' !== $target[0]))) {
156+
} elseif (!$autowire || (!($autowireAttributes = $p->getAttributes(Autowire::class, \ReflectionAttribute::IS_INSTANCEOF)) && (!$type || '\\' !== $target[0]))) {
159157
continue;
160158
} elseif (is_subclass_of($type, \UnitEnum::class)) {
161159
// do not attempt to register enum typed arguments if not already present in bindings

0 commit comments

Comments
 (0)
0