add method getListenerPriority() to interface

This commit is contained in:
Christian Flothmann 2015-10-20 19:32:54 +02:00
parent 99de3fd49d
commit f8019c80b4
4 changed files with 17 additions and 8 deletions

View File

@ -107,6 +107,8 @@ UPGRADE FROM 2.x to 3.0
### EventDispatcher ### EventDispatcher
* The method `getListenerPriority($eventName, $listener)` has been added to the
`EventDispatcherInterface`.
* The interface `Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcherInterface` * The interface `Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcherInterface`
extends `Symfony\Component\EventDispatcher\EventDispatcherInterface`. extends `Symfony\Component\EventDispatcher\EventDispatcherInterface`.

View File

@ -4,6 +4,8 @@ CHANGELOG
3.0.0 3.0.0
----- -----
* The method `getListenerPriority($eventName, $listener)` has been added to the
`EventDispatcherInterface`.
* The methods `Event::setDispatcher()`, `Event::getDispatcher()`, `Event::setName()` * The methods `Event::setDispatcher()`, `Event::getDispatcher()`, `Event::setName()`
and `Event::getName()` have been removed. and `Event::getName()` have been removed.
The event dispatcher and the event name are passed to the listener call. The event dispatcher and the event name are passed to the listener call.

View File

@ -73,14 +73,7 @@ class EventDispatcher implements EventDispatcherInterface
} }
/** /**
* Gets the listener priority for a specific event. * {@inheritdoc}
*
* Returns null if the event or the listener does not exist.
*
* @param string $eventName The name of the event
* @param callable $listener The listener to remove
*
* @return int|null The event listener priority
*/ */
public function getListenerPriority($eventName, $listener) public function getListenerPriority($eventName, $listener)
{ {

View File

@ -77,6 +77,18 @@ interface EventDispatcherInterface
*/ */
public function getListeners($eventName = null); public function getListeners($eventName = null);
/**
* Gets the listener priority for a specific event.
*
* Returns null if the event or the listener does not exist.
*
* @param string $eventName The name of the event
* @param callable $listener The listener
*
* @return int|null The event listener priority
*/
public function getListenerPriority($eventName, $listener);
/** /**
* Checks whether an event has any registered listeners. * Checks whether an event has any registered listeners.
* *