Update Composer, update everything
This commit is contained in:
parent
ea3e94409f
commit
dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Drupal\Component\EventDispatcher;
|
||||
|
||||
use Symfony\Component\DependencyInjection\IntrospectableContainerInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
@ -36,7 +36,7 @@ class ContainerAwareEventDispatcher implements EventDispatcherInterface {
|
|||
/**
|
||||
* The service container.
|
||||
*
|
||||
* @var \Symfony\Component\DependencyInjection\IntrospectableContainerInterface;
|
||||
* @var \Symfony\Component\DependencyInjection\ContainerInterface
|
||||
*/
|
||||
protected $container;
|
||||
|
||||
|
@ -66,7 +66,7 @@ class ContainerAwareEventDispatcher implements EventDispatcherInterface {
|
|||
/**
|
||||
* Constructs a container aware event dispatcher.
|
||||
*
|
||||
* @param \Symfony\Component\DependencyInjection\IntrospectableContainerInterface $container
|
||||
* @param \Symfony\Component\DependencyInjection\ContainerInterface $container
|
||||
* The service container.
|
||||
* @param array $listeners
|
||||
* A nested array of listener definitions keyed by event name and priority.
|
||||
|
@ -77,7 +77,7 @@ class ContainerAwareEventDispatcher implements EventDispatcherInterface {
|
|||
* A service entry will be resolved to a callable only just before its
|
||||
* invocation.
|
||||
*/
|
||||
public function __construct(IntrospectableContainerInterface $container, array $listeners = []) {
|
||||
public function __construct(ContainerInterface $container, array $listeners = []) {
|
||||
$this->container = $container;
|
||||
$this->listeners = $listeners;
|
||||
$this->unsorted = [];
|
||||
|
@ -91,9 +91,6 @@ class ContainerAwareEventDispatcher implements EventDispatcherInterface {
|
|||
$event = new Event();
|
||||
}
|
||||
|
||||
$event->setDispatcher($this);
|
||||
$event->setName($event_name);
|
||||
|
||||
if (isset($this->listeners[$event_name])) {
|
||||
// Sort listeners if necessary.
|
||||
if (isset($this->unsorted[$event_name])) {
|
||||
|
@ -107,8 +104,11 @@ class ContainerAwareEventDispatcher implements EventDispatcherInterface {
|
|||
if (!isset($definition['callable'])) {
|
||||
$definition['callable'] = [$this->container->get($definition['service'][0]), $definition['service'][1]];
|
||||
}
|
||||
if (is_array($definition['callable']) && isset($definition['callable'][0]) && $definition['callable'][0] instanceof \Closure) {
|
||||
$definition['callable'][0] = $definition['callable'][0]();
|
||||
}
|
||||
|
||||
$definition['callable']($event, $event_name, $this);
|
||||
call_user_func($definition['callable'], $event, $event_name, $this);
|
||||
if ($event->isPropagationStopped()) {
|
||||
return $event;
|
||||
}
|
||||
|
@ -147,6 +147,9 @@ class ContainerAwareEventDispatcher implements EventDispatcherInterface {
|
|||
if (!isset($definition['callable'])) {
|
||||
$definition['callable'] = [$this->container->get($definition['service'][0]), $definition['service'][1]];
|
||||
}
|
||||
if (is_array($definition['callable']) && isset($definition['callable'][0]) && $definition['callable'][0] instanceof \Closure) {
|
||||
$definition['callable'][0] = $definition['callable'][0]();
|
||||
}
|
||||
|
||||
$result[] = $definition['callable'];
|
||||
}
|
||||
|
@ -159,27 +162,29 @@ class ContainerAwareEventDispatcher implements EventDispatcherInterface {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getListenerPriority($eventName, $listener) {
|
||||
// Parts copied from \Symfony\Component\EventDispatcher, that's why you see
|
||||
// a yoda condition here.
|
||||
if (!isset($this->listeners[$eventName])) {
|
||||
public function getListenerPriority($event_name, $listener) {
|
||||
if (!isset($this->listeners[$event_name])) {
|
||||
return;
|
||||
}
|
||||
foreach ($this->listeners[$eventName] as $priority => $listeners) {
|
||||
if (FALSE !== ($key = array_search(['callable' => $listener], $listeners, TRUE))) {
|
||||
return $priority;
|
||||
}
|
||||
if (is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure) {
|
||||
$listener[0] = $listener[0]();
|
||||
}
|
||||
// Resolve service definitions if the listener has not been found so far.
|
||||
foreach ($this->listeners[$eventName] as $priority => &$definitions) {
|
||||
foreach ($this->listeners[$event_name] as $priority => &$definitions) {
|
||||
foreach ($definitions as $key => &$definition) {
|
||||
if (!isset($definition['callable'])) {
|
||||
// Once the callable is retrieved we keep it for subsequent method
|
||||
// invocations on this class.
|
||||
$definition['callable'] = [$this->container->get($definition['service'][0]), $definition['service'][1]];
|
||||
if ($definition['callable'] === $listener) {
|
||||
return $priority;
|
||||
}
|
||||
$definition['callable'] = [
|
||||
$this->container->get($definition['service'][0]),
|
||||
$definition['service'][1],
|
||||
];
|
||||
}
|
||||
if (is_array($definition['callable']) && isset($definition['callable'][0]) && $definition['callable'][0] instanceof \Closure) {
|
||||
$definition['callable'][0] = $definition['callable'][0]();
|
||||
}
|
||||
if ($definition['callable'] === $listener) {
|
||||
return $priority;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -189,7 +194,17 @@ class ContainerAwareEventDispatcher implements EventDispatcherInterface {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasListeners($event_name = NULL) {
|
||||
return (bool) count($this->getListeners($event_name));
|
||||
if ($event_name !== NULL) {
|
||||
return !empty($this->listeners[$event_name]);
|
||||
}
|
||||
|
||||
foreach ($this->listeners as $event_listeners) {
|
||||
if ($event_listeners) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -217,9 +232,22 @@ class ContainerAwareEventDispatcher implements EventDispatcherInterface {
|
|||
$definition['callable'] = [$this->container->get($definition['service'][0]), $definition['service'][1]];
|
||||
}
|
||||
|
||||
if ($definition['callable'] === $listener) {
|
||||
unset($this->listeners[$event_name][$priority][$key]);
|
||||
if (is_array($definition['callable']) && isset($definition['callable'][0]) && $definition['callable'][0] instanceof \Closure && !$listener instanceof \Closure) {
|
||||
$definition['callable'][0] = $definition['callable'][0]();
|
||||
}
|
||||
|
||||
if (is_array($definition['callable']) && isset($definition['callable'][0]) && !$definition['callable'][0] instanceof \Closure && is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure) {
|
||||
$listener[0] = $listener[0]();
|
||||
}
|
||||
if ($definition['callable'] === $listener) {
|
||||
unset($definitions[$key]);
|
||||
}
|
||||
}
|
||||
if ($definitions) {
|
||||
$this->listeners[$event_name][$priority] = $definitions;
|
||||
}
|
||||
else {
|
||||
unset($this->listeners[$event_name][$priority]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
"description": "EventDispatcher.",
|
||||
"keywords": ["drupal"],
|
||||
"homepage": "https://www.drupal.org/project/drupal",
|
||||
"license": "GPL-2.0+",
|
||||
"license": "GPL-2.0-or-later",
|
||||
"require": {
|
||||
"php": ">=5.5.9",
|
||||
"symfony/dependency-injection": "~2.8",
|
||||
"symfony/event-dispatcher": "~2.7"
|
||||
"symfony/dependency-injection": ">=2.8 <4.0.0",
|
||||
"symfony/event-dispatcher": ">=2.7 <4.0.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
|
Reference in a new issue