Commit eade992
committed
Do not ignore enum when Autowire attribute in RegisterControllerArgumentLocatorsPass
When moving services injected from the constructor to the controller arguments, I noticed a bug.
We were auto wiring an env var to a backed enum like this:
```php
class Foo
{
public function __construct(
#[Autowire(env: 'enum:App\Enum:SOME_ENV_KEY')]
private \App\Enum $someEnum,
) {}
public function __invoke() {}
}
```
This works fine with normal Symfony Dependency Injection.
But when we switch to controller arguments like this:
```php
class Foo
{
public function __invoke(
#[Autowire(env: 'enum:App\Enum:SOME_ENV_KEY')]
\App\Enum $someEnum,
) {}
}
```
This stops working.
The issue is that BackedEnum's are excluded. But this should only be excluded when there is no Autowire attribute.1 parent a83a10d commit eade992
File tree
2 files changed
+5
-2
lines changed- DependencyInjection
- Tests/DependencyInjection
2 files changed
+5
-2
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
162 | | - | |
| 162 | + | |
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| |||
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
498 | 498 | | |
499 | 499 | | |
500 | 500 | | |
501 | | - | |
| 501 | + | |
502 | 502 | | |
503 | 503 | | |
504 | 504 | | |
505 | 505 | | |
506 | 506 | | |
507 | 507 | | |
| 508 | + | |
508 | 509 | | |
509 | 510 | | |
510 | 511 | | |
| |||
719 | 720 | | |
720 | 721 | | |
721 | 722 | | |
| 723 | + | |
| 724 | + | |
722 | 725 | | |
723 | 726 | | |
724 | 727 | | |
| |||
0 commit comments