Mercurial > hg > isophonics-drupal-site
diff vendor/symfony/event-dispatcher/ContainerAwareEventDispatcher.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 1fec387a4317 |
children |
line wrap: on
line diff
--- a/vendor/symfony/event-dispatcher/ContainerAwareEventDispatcher.php Tue Jul 10 15:07:59 2018 +0100 +++ b/vendor/symfony/event-dispatcher/ContainerAwareEventDispatcher.php Thu Feb 28 13:21:36 2019 +0000 @@ -30,18 +30,18 @@ /** * The service IDs of the event listeners and subscribers. */ - private $listenerIds = array(); + private $listenerIds = []; /** * The services registered as listeners. */ - private $listeners = array(); + private $listeners = []; public function __construct(ContainerInterface $container) { $this->container = $container; - $class = get_class($this); + $class = \get_class($this); if ($this instanceof \PHPUnit_Framework_MockObject_MockObject || $this instanceof \Prophecy\Doubler\DoubleInterface) { $class = get_parent_class($class); } @@ -66,11 +66,11 @@ { @trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use EventDispatcher with closure factories instead.', __CLASS__), E_USER_DEPRECATED); - if (!is_array($callback) || 2 !== count($callback)) { - throw new \InvalidArgumentException('Expected an array("service", "method") argument'); + if (!\is_array($callback) || 2 !== \count($callback)) { + throw new \InvalidArgumentException('Expected an ["service", "method"] argument'); } - $this->listenerIds[$eventName][] = array($callback[0], $callback[1], $priority); + $this->listenerIds[$eventName][] = [$callback[0], $callback[1], $priority]; } public function removeListener($eventName, $listener) @@ -80,7 +80,7 @@ if (isset($this->listenerIds[$eventName])) { foreach ($this->listenerIds[$eventName] as $i => list($serviceId, $method)) { $key = $serviceId.'.'.$method; - if (isset($this->listeners[$eventName][$key]) && $listener === array($this->listeners[$eventName][$key], $method)) { + if (isset($this->listeners[$eventName][$key]) && $listener === [$this->listeners[$eventName][$key], $method]) { unset($this->listeners[$eventName][$key]); if (empty($this->listeners[$eventName])) { unset($this->listeners[$eventName]); @@ -149,13 +149,13 @@ @trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use EventDispatcher with closure factories instead.', __CLASS__), E_USER_DEPRECATED); foreach ($class::getSubscribedEvents() as $eventName => $params) { - if (is_string($params)) { - $this->listenerIds[$eventName][] = array($serviceId, $params, 0); - } elseif (is_string($params[0])) { - $this->listenerIds[$eventName][] = array($serviceId, $params[0], isset($params[1]) ? $params[1] : 0); + if (\is_string($params)) { + $this->listenerIds[$eventName][] = [$serviceId, $params, 0]; + } elseif (\is_string($params[0])) { + $this->listenerIds[$eventName][] = [$serviceId, $params[0], isset($params[1]) ? $params[1] : 0]; } else { foreach ($params as $listener) { - $this->listenerIds[$eventName][] = array($serviceId, $listener[0], isset($listener[1]) ? $listener[1] : 0); + $this->listenerIds[$eventName][] = [$serviceId, $listener[0], isset($listener[1]) ? $listener[1] : 0]; } } } @@ -184,10 +184,10 @@ $key = $serviceId.'.'.$method; if (!isset($this->listeners[$eventName][$key])) { - $this->addListener($eventName, array($listener, $method), $priority); + $this->addListener($eventName, [$listener, $method], $priority); } elseif ($this->listeners[$eventName][$key] !== $listener) { - parent::removeListener($eventName, array($this->listeners[$eventName][$key], $method)); - $this->addListener($eventName, array($listener, $method), $priority); + parent::removeListener($eventName, [$this->listeners[$eventName][$key], $method]); + $this->addListener($eventName, [$listener, $method], $priority); } $this->listeners[$eventName][$key] = $listener;