Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public function process(ContainerBuilder $container)
continue;
} elseif (!$autowire || (!($autowireAttributes ??= $p->getAttributes(Autowire::class, \ReflectionAttribute::IS_INSTANCEOF)) && (!$type || '\\' !== $target[0]))) {
continue;
} elseif (is_subclass_of($type, \UnitEnum::class)) {
} elseif (!$autowireAttributes && is_subclass_of($type, \UnitEnum::class)) {
// do not attempt to register enum typed arguments if not already present in bindings
continue;
} elseif (!$p->allowsNull()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,13 +498,14 @@ public function testAutowireAttribute()

$locator = $container->get($locatorId)->get('foo::fooAction');

$this->assertCount(9, $locator->getProvidedServices());
$this->assertCount(10, $locator->getProvidedServices());
$this->assertInstanceOf(\stdClass::class, $locator->get('service1'));
$this->assertSame('foo/bar', $locator->get('value'));
$this->assertSame('foo', $locator->get('expression'));
$this->assertInstanceOf(\stdClass::class, $locator->get('serviceAsValue'));
$this->assertInstanceOf(\stdClass::class, $locator->get('expressionAsValue'));
$this->assertSame('bar', $locator->get('rawValue'));
$this->stringContains('Symfony_Component_HttpKernel_Tests_Fixtures_Suit_APP_SUIT', $locator->get('suit'));
$this->assertSame('@bar', $locator->get('escapedRawValue'));
$this->assertSame('foo', $locator->get('customAutowire'));
$this->assertInstanceOf(FooInterface::class, $autowireCallable = $locator->get('autowireCallable'));
Expand Down Expand Up @@ -719,6 +720,8 @@ public function fooAction(
\stdClass $expressionAsValue,
#[Autowire('bar')]
string $rawValue,
#[Autowire(env: 'enum:\Symfony\Component\HttpKernel\Tests\Fixtures\Suit:APP_SUIT')]
Suit $suit,
#[Autowire('@@bar')]
string $escapedRawValue,
#[CustomAutowire('some.parameter')]
Expand Down
Loading