8000 [DependencyInjection] Partially revert #40406 · symfony/symfony@f94fb5d · GitHub
[go: up one dir, main page]

Skip to content

Commit f94fb5d

Browse files
committed
[DependencyInjection] Partially revert #40406
1 parent a3fda74 commit f94fb5d

File tree

2 files changed

+5
-30
lines changed

2 files changed

+5
-30
lines changed

src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212
namespace Symfony\Component\DependencyInjection\Compiler;
1313

1414
use Symfony\Component\Config\Resource\ClassExistenceResource;
15-
use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument;
16-
use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
17-
use Symfony\Component\DependencyInjection\Attribute\TaggedIterator;
18-
use Symfony\Component\DependencyInjection\Attribute\TaggedLocator;
1915
use Symfony\Component\DependencyInjection\Attribute\Target;
2016
use Symfony\Component\DependencyInjection\ContainerBuilder;
2117
use Symfony\Component\DependencyInjection\Definition;
@@ -139,8 +135,7 @@ private function doProcessValue($value, bool $isRoot = false)
139135
array_unshift($this->methodCalls, [$constructor, $value->getArguments()]);
140136
}
141137

142-
$checkAttributes = 80000 <= \PHP_VERSION_ID && !$value->hasTag('container.ignore_attributes');
143-
$this->methodCalls = $this->autowireCalls($reflectionClass, $isRoot, $checkAttributes);
138+
$this->methodCalls = $this->autowireCalls($reflectionClass, $isRoot);
144139

145140
if ($constructor) {
146141
[, $arguments] = array_shift($this->methodCalls);
@@ -157,7 +152,7 @@ private function doProcessValue($value, bool $isRoot = false)
157152
return $value;
158153
}
159154

160-
private function autowireCalls(\ReflectionClass $reflectionClass, bool $isRoot, bool $checkAttributes): array
155+
private function autowireCalls(\ReflectionClass $reflectionClass, bool $isRoot): array
161156
{
162157
$this->decoratedId = null;
163158
$this->decoratedClass = null;
@@ -186,7 +181,7 @@ private function autowireCalls(\ReflectionClass $reflectionClass, bool $isRoot,
186181
}
187182
}
188183

189-
$arguments = $this->autowireMethod($reflectionMethod, $arguments, $checkAttributes, $i);
184+
$arguments = $this->autowireMethod($reflectionMethod, $arguments, $i);
190185

191186
if ($arguments !== $call[1]) {
192187
$this->methodCalls[$i][1] = $arguments;
@@ -227,7 +222,7 @@ private function autowireCalls(\ReflectionClass $reflectionClass, bool $isRoot,
227222
*
228223
* @throws AutowiringFailedException
229224
*/
230-
private function autowireMethod(\ReflectionFunctionAbstract $reflectionMethod, array $arguments, bool $checkAttributes, int $methodIndex): array
225+
private function autowireMethod(\ReflectionFunctionAbstract $reflectionMethod, array $arguments, int $methodIndex): array
231226
{
232227
$class = $reflectionMethod instanceof \ReflectionMethod ? $reflectionMethod->class : $this->currentId;
233228
$method = $reflectionMethod->name;
@@ -246,26 +241,6 @@ private function autowireMethod(\ReflectionFunctionAbstract $reflectionMethod, a
246241

247242
$type = ProxyHelper::getTypeHint($reflectionMethod, $parameter, true);
248243

249-
if ($checkAttributes) {
250-
foreach ( 10000 $parameter->getAttributes() as $attribute) {
251-
if (TaggedIterator::class === $attribute->getName()) {
252-
$attribute = $attribute->newInstance();
253-
$arguments[$index] = new TaggedIteratorArgument($attribute->tag, $attribute->indexAttribute, $attribute->defaultIndexMethod, false, $attribute->defaultPriorityMethod);
254-
break;
255-
}
256-
257-
if (TaggedLocator::class === $attribute->getName()) {
258-
$attribute = $attribute->newInstance();
259-
$arguments[$index] = new ServiceLocatorArgument(new TaggedIteratorArgument($attribute->tag, $attribute->indexAttribute, $attribute->defaultIndexMethod, true, $attribute->defaultPriorityMethod));
260-
break;
261-
}
262-
}
263-
264-
if ('' !== ($arguments[$index] ?? '')) {
265-
continue;
266-
}
267-
}
268-
269244
if (!$type) {
270245
if (isset($arguments[$index])) {
271246
continue;

src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ public function __construct()
6262
new AutowireRequiredMethodsPass(),
6363
new AutowireRequiredPropertiesPass(),
6464
new ResolveBindingsPass(),
65+
new ServiceLocatorTagPass(),
6566
new DecoratorServicePass(),
6667
new CheckDefinitionValidityPass(),
6768
new AutowirePass(false),
68-
new ServiceLocatorTagPass(),
6969
new ResolveTaggedIteratorArgumentPass(),
7070
new ResolveServiceSubscribersPass(),
7171
new ResolveReferencesToAliasesPass(),

0 commit comments

Comments
 (0)
0