Problem/Motivation
Method "Symfony\Component\EventDispatcher\EventSubscriberInterface::getSubscribedEvents()" will return "array" as of its next major version.
Steps to reproduce
Proposed resolution
Add "array" return type hint.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | 3232097-8.patch | 78.76 KB | longwave |
| #2 | 3232097-2.patch | 81.41 KB | daffie |
Comments
Comment #2
daffie commentedThe problem for adding this return type hint is that a lot of contrib modules override the method. See: http://grep.xnddx.ru/search?text=public+static+function+getSubscribedEve.... Maybe we need to wait for D10.0 to commit this patch.
Comment #3
catchWe should be OK to commit a patch for all the non-base classes in Drupal 9. The base classes will need to wait for Drupal 10 though.
Comment #4
larowlanAgree
Comment #5
daffie commentedPart of the Symfony 6 in D10 initiative.
Comment #6
longwaveNeeds work to handle the non-base classes here and a new issue to postpone the base classes until Drupal 10.
Comment #7
daffie commentedMoving this to the 10.0 branch.
Comment #8
longwaveThe abstract classes that implement this method are:
I reverted these changes from the patch so only concrete classes remain. I agree with #3/#4 that extending existing event subscribers is likely a non-standard thing to do and so we should be able to commit this to 9.4.x.
Comment #9
longwave#2 can go into 10.0.x as it changes all classes, #8 should be able to go into 9.4.x as it changes concrete classes only.
Comment #10
catchSent #2 for a retest, think that was from when 10.x testing was broken.
Agreed both patches look ready.
Comment #11
alexpottCommitted 1359e7a and pushed to 10.0.x. Thanks!
I've committed #2 to 10.0.x
I think we need a little bit more discussion about committing #8 to 9.4.x. I'm not sure because I know people do extend events and potentially override getSubscribedEvents... see http://grep.xnddx.ru/search?text=parent%3A%3AgetSubscribedEvents&filename=
Personally I think we should only make this change in Drupal 10 to give people a chance to update their code because if they extend core and add the return typehint they can be 9 & 10 compatible. Setting back to needs review for more discussion.
Comment #13
daffie commentedFor me this is a 10.0.x change only. For me this issues can be marked as fixed.
Comment #14
catchI think we should mark this fixed for 10.0.x, then re-open for backport if we discover a reason to.