Skip to content

Commit

Permalink
minor #36710 [DI][EventDispatcher] added contract for implementation …
Browse files Browse the repository at this point in the history
…(bestform)

This PR was merged into the 3.4 branch.

Discussion
----------

[DI][EventDispatcher] added contract for implementation

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #36708
| License       | MIT

As described in the attached issue a comment in the documentation of the `EventSubscriberInterface` would be helpful to make sure users do not use logic based on runtime state in their implementation of `getSubscribedEvents`.

Commits
-------

88e43d4 [DI][EventDispatcher] added contract for implementation
  • Loading branch information
nicolas-grekas committed May 8, 2020
2 parents 94482fe + 88e43d4 commit f6ae18e
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ interface EventSubscriberInterface
* * ['eventName' => ['methodName', $priority]]
* * ['eventName' => [['methodName1', $priority], ['methodName2']]]
*
* The code must not depend on runtime state as it will only be called at compile time.
* All logic depending on runtime state must be put into the individual methods handling the events.
*
* @return array The event names to listen to
*/
public static function getSubscribedEvents();
Expand Down

0 comments on commit f6ae18e

Please sign in to comment.