Commit 30594b2
committed
bug #44838 [DependencyInjection][HttpKernel] Fix enum typed bindings (ogizanagi)
This PR was merged into the 4.4 branch.
Discussion
----------
[DependencyInjection][HttpKernel] Fix enum typed bindings
| Q | A
| ------------- | ---
| Branch? | 4.4 <!-- see below -->
| Bug fix? | yes
| New feature? | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets | N/A <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
Relates to #44834
While:
```yml
# services.yaml
services:
_defaults:
autowire: true
autoconfigure: true
bind:
$myParam: !php/const App\Status::Deleted
```
is working for me, the following isn't:
```diff
# services.yaml
services:
_defaults:
autowire: true
autoconfigure: true
bind:
- $myParam: !php/const App\Status::Deleted
+ App\Status $myParam: !php/const App\Status::Deleted
```
->
> Invalid value for binding key "App\Status $myParam" for service […]: expected "Symfony\Component\DependencyInjection\Reference", "Symfony\Component\DependencyInjection\Definition", "Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument", "Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument" or null, "App\Status" given.
This attempts to fix it by accounting for `\UnitEnum` in the `ResolveBindingPass`,
as well as re-allowing enum types already present in bindings after #44826.
Commits
-------
c32d749 [DependencyInjection][HttpKernel] Fix enum typed bindingsFile tree
4 files changed
+50
-5
lines changed- src/Symfony/Component
- DependencyInjection
- Compiler
- Tests
- Compiler
- Fixtures
- HttpKernel/DependencyInjection
4 files changed
+50
-5
lines changedLines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
136 | 141 | | |
137 | 142 | | |
138 | 143 | | |
| |||
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
63 | 65 | | |
64 | 66 | | |
65 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
66 | 89 | | |
67 | 90 | | |
68 | 91 | | |
| |||
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
Lines changed: 3 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | 130 | | |
136 | 131 | | |
137 | 132 | | |
| |||
156 | 151 | | |
157 | 152 | | |
158 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
159 | 157 | | |
160 | 158 | | |
161 | 159 | | |
| |||
0 commit comments