Skip to content

Commit a8babc1

Browse files
committed
[DependencyInjection] Partially revert symfony#40406
1 parent 3c3250f commit a8babc1

File tree

2 files changed

+5
-26
lines changed

2 files changed

+5
-26
lines changed

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

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,7 @@ private function doProcessValue($value, bool $isRoot = false)
139139
array_unshift($this->methodCalls, [$constructor, $value->getArguments()]);
140140
}
141141

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

145144
if ($constructor) {
146145
[, $arguments] = array_shift($this->methodCalls);
@@ -157,7 +156,7 @@ private function doProcessValue($value, bool $isRoot = false)
157156
return $value;
158157
}
159158

160-
private function autowireCalls(\ReflectionClass $reflectionClass, bool $isRoot, bool $checkAttributes): array
159+
private function autowireCalls(\ReflectionClass $reflectionClass, bool $isRoot): array
161160
{
162161
$this->decoratedId = null;
163162
$this->decoratedClass = null;
@@ -186,7 +185,7 @@ private function autowireCalls(\ReflectionClass $reflectionClass, bool $isRoot,
186185
}
187186
}
188187

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

191190
if ($arguments !== $call[1]) {
192191
$this->methodCalls[$i][1] = $arguments;
@@ -227,7 +226,7 @@ private function autowireCalls(\ReflectionClass $reflectionClass, bool $isRoot,
227226
*
228227
* @throws AutowiringFailedException
229228
*/
230-
private function autowireMethod(\ReflectionFunctionAbstract $reflectionMethod, array $arguments, bool $checkAttributes, int $methodIndex): array
229+
private function autowireMethod(\ReflectionFunctionAbstract $reflectionMethod, array $arguments, int $methodIndex): array
231230
{
232231
$class = $reflectionMethod instanceof \ReflectionMethod ? $reflectionMethod->class : $this->currentId;
233232
$method = $reflectionMethod->name;
@@ -246,26 +245,6 @@ private function autowireMethod(\ReflectionFunctionAbstract $reflectionMethod, a
246245

247246
$type = ProxyHelper::getTypeHint($reflectionMethod, $parameter, true);
248247

249-
if ($checkAttributes) {
250-
foreach ($parameter->getAttributes() as $attribute) {
251-
if (TaggedIterator::class === $attribute->getName()) {
252-
$attribute = $attribute->newInstance();
253-
$arguments[$index] = new TaggedIteratorArgument($attribute->tag, $attribute->indexAttribute);
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, null, true));
260-
break;
261-
}
262-
}
263-
264-
if ('' !== ($arguments[$index] ?? '')) {
265-
continue;
266-
}
267-
}
268-
269248
if (!$type) {
270249
if (isset($arguments[$index])) {
271250
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)