Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c12b7f0

Browse filesBrowse files
[DependencyInjection] Fix resolving parameters found in #[Autowire]
1 parent 0e9cfc3 commit c12b7f0
Copy full SHA for c12b7f0

File tree

Expand file treeCollapse file tree

2 files changed

+2
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+2
-1
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ private function autowireMethod(\ReflectionFunctionAbstract $reflectionMethod, a
263263

264264
if (Autowire::class === $attribute->getName()) {
265265
$value = $attribute->newInstance()->value;
266+
$value = $this->container->getParameterBag()->resolveValue($value);
266267

267268
if ($value instanceof Reference && $parameter->allowsNull()) {
268269
$value = new Reference($value, ContainerInterface::NULL_ON_INVALID_REFERENCE);

‎src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1145,7 +1145,7 @@ public function testAutowireAttribute()
11451145
$this->assertCount(8, $definition->getArguments());
11461146
$this->assertEquals(new Reference('some.id'), $definition->getArgument(0));
11471147
$this->assertEquals(new Expression("parameter('some.parameter')"), $definition->getArgument(1));
1148-
$this->assertSame('%some.parameter%/bar', $definition->getArgument(2));
1148+
$this->assertSame('foo/bar', $definition->getArgument(2));
11491149
$this->assertEquals(new Reference('some.id'), $definition->getArgument(3));
11501150
$this->assertEquals(new Expression("parameter('some.parameter')"), $definition->getArgument(4));
11511151
$this->assertSame('bar', $definition->getArgument(5));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.