Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
Commit5c76029
committed
bug#62184 [EventDispatcher][FrameworkBundle] Rework union types on
This PR was merged into the 7.4 branch.Discussion----------[EventDispatcher][FrameworkBundle] Rework union types on `#[AsEventListener]`| Q | A| ------------- | ---| Branch? | 7.4| Bug fix? | yes| New feature? | no| Deprecations? | no| Issues | -| License | MITThis is a reimplementation of#61252.The previous PR introduced a backward compatibility break.Consider the following listener:```phpfinal class TestListener{ #[AsEventListener(event: RequestEvent::class)] public function onRequestEvent(): void { // ... }}```In earlier versions, this worked fine, but now it throws:> AsEventListener attribute requires the first argument of "App\EventListener\TestListener::onRequestEvent()" to be an event object.Interestingly, there *was* a test for this scenario, but since each test method re-defines the `registerAttributeForAutoconfiguration()` closure (which wasn't updated everywhere), the tests still passed.Additionally, the implementation was added to the `FrameworkExtension`, even though similar logic already existed in `RegisterListenersPass::getEventFromTypeDeclaration()`, resulting in a decentralized implementation.This PR reverts the changes in `FrameworkExtension` and re-implements the feature in `RegisterListenersPass`.The tests now reuse the closure from `FrameworkExtension` to make them more robust and consistent with the actual implementation.Commits-------8ea7196 [EventDispatcher][FrameworkBundle] Rework union types on `#[AsEventListener]`#[AsEventListener] (HypeMC)File tree
4 files changed
+60
-83
lines changed- src/Symfony
- Bundle/FrameworkBundle/DependencyInjection
- Component/EventDispatcher
- DependencyInjection
- Tests/DependencyInjection
4 files changed
+60
-83
lines changedLines changed: 5 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
779 | 779 | | |
780 | 780 | | |
781 | 781 | | |
782 | | - | |
783 | | - | |
784 | | - | |
785 | | - | |
786 | | - | |
787 | | - | |
788 | | - | |
789 | | - | |
790 | | - | |
791 | | - | |
792 | | - | |
793 | | - | |
794 | | - | |
795 | | - | |
796 | | - | |
797 | | - | |
798 | | - | |
799 | | - | |
800 | | - | |
801 | | - | |
802 | | - | |
803 | | - | |
804 | | - | |
805 | | - | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
806 | 785 | | |
| 786 | + | |
807 | 787 | | |
| 788 | + | |
808 | 789 | | |
809 | 790 | | |
810 | 791 | | |
| |||
Lines changed: 36 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
68 | 69 | | |
69 | | - | |
70 | | - | |
71 | 70 | | |
72 | 71 | | |
73 | 72 | | |
74 | 73 | | |
75 | 74 | | |
76 | 75 | | |
77 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
78 | 84 | | |
| 85 | + | |
79 | 86 | | |
80 | | - | |
| 87 | + | |
| 88 | + | |
81 | 89 | | |
82 | 90 | | |
83 | 91 | | |
| |||
167 | 175 | | |
168 | 176 | | |
169 | 177 | | |
170 | | - | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
171 | 182 | | |
172 | 183 | | |
173 | 184 | | |
174 | 185 | | |
175 | 186 | | |
176 | 187 | | |
177 | | - | |
178 | | - | |
179 | | - | |
| 188 | + | |
180 | 189 | | |
181 | 190 | | |
182 | 191 | | |
183 | 192 | | |
184 | | - | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
185 | 212 | | |
186 | 213 | | |
187 | 214 | | |
| |||
Lines changed: 18 additions & 50 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | | - | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
| |||
275 | 274 | | |
276 | 275 | | |
277 | 276 | | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
| 277 | + | |
282 | 278 | | |
283 | 279 | | |
284 | 280 | | |
| |||
297 | 293 | | |
298 | 294 | | |
299 | 295 | | |
300 | | - | |
| 296 | + | |
301 | 297 | | |
302 | 298 | | |
303 | 299 | | |
304 | 300 | | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
| 301 | + | |
315 | 302 | | |
316 | 303 | | |
317 | 304 | | |
| |||
355 | 342 | | |
356 | 343 | | |
357 | 344 | | |
358 | | - | |
| 345 | + | |
359 | 346 | | |
360 | 347 | | |
361 | 348 | | |
362 | 349 | | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
| 350 | + | |
394 | 351 | | |
395 | 352 | | |
396 | 353 | | |
| |||
419 | 376 | | |
420 | 377 | | |
421 | 378 | | |
422 | | - | |
| 379 | + | |
423 | 380 | | |
424 | 381 | | |
425 | 382 | | |
| |||
569 | 526 | | |
570 | 527 | | |
571 | 528 | | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
572 | 540 | | |
573 | 541 | | |
574 | 542 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
0 commit comments
Comments
(0)