update2
This commit is contained in:
parent
98419bd18d
commit
8a69e45efa
4919 changed files with 28311 additions and 224136 deletions
0
pfosten/vendor/symfony/event-dispatcher/.gitignore
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/event-dispatcher/.gitignore
vendored
Executable file → Normal file
5
pfosten/vendor/symfony/event-dispatcher/CHANGELOG.md
vendored
Executable file → Normal file
5
pfosten/vendor/symfony/event-dispatcher/CHANGELOG.md
vendored
Executable file → Normal file
|
|
@ -1,6 +1,11 @@
|
|||
CHANGELOG
|
||||
=========
|
||||
|
||||
3.4.0
|
||||
-----
|
||||
|
||||
* Implementing `TraceableEventDispatcherInterface` without the `reset()` method has been deprecated.
|
||||
|
||||
3.3.0
|
||||
-----
|
||||
|
||||
|
|
|
|||
34
pfosten/vendor/symfony/event-dispatcher/ContainerAwareEventDispatcher.php
vendored
Executable file → Normal file
34
pfosten/vendor/symfony/event-dispatcher/ContainerAwareEventDispatcher.php
vendored
Executable file → Normal file
|
|
@ -25,42 +25,28 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
|||
*/
|
||||
class ContainerAwareEventDispatcher extends EventDispatcher
|
||||
{
|
||||
/**
|
||||
* The container from where services are loaded.
|
||||
*
|
||||
* @var ContainerInterface
|
||||
*/
|
||||
private $container;
|
||||
|
||||
/**
|
||||
* The service IDs of the event listeners and subscribers.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $listenerIds = array();
|
||||
|
||||
/**
|
||||
* The services registered as listeners.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $listeners = array();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param ContainerInterface $container A ContainerInterface instance
|
||||
*/
|
||||
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);
|
||||
}
|
||||
if (__CLASS__ !== $class) {
|
||||
@trigger_error(sprintf('The %s class is deprecated since version 3.3 and will be removed in 4.0. Use EventDispatcher with closure factories instead.', __CLASS__), E_USER_DEPRECATED);
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -78,9 +64,9 @@ class ContainerAwareEventDispatcher extends EventDispatcher
|
|||
*/
|
||||
public function addListenerService($eventName, $callback, $priority = 0)
|
||||
{
|
||||
@trigger_error(sprintf('The %s class is deprecated since version 3.3 and will be removed in 4.0. Use EventDispatcher with closure factories instead.', __CLASS__), E_USER_DEPRECATED);
|
||||
@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)) {
|
||||
if (!\is_array($callback) || 2 !== \count($callback)) {
|
||||
throw new \InvalidArgumentException('Expected an array("service", "method") argument');
|
||||
}
|
||||
|
||||
|
|
@ -92,7 +78,7 @@ class ContainerAwareEventDispatcher extends EventDispatcher
|
|||
$this->lazyLoad($eventName);
|
||||
|
||||
if (isset($this->listenerIds[$eventName])) {
|
||||
foreach ($this->listenerIds[$eventName] as $i => list($serviceId, $method, $priority)) {
|
||||
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)) {
|
||||
unset($this->listeners[$eventName][$key]);
|
||||
|
|
@ -160,12 +146,12 @@ class ContainerAwareEventDispatcher extends EventDispatcher
|
|||
*/
|
||||
public function addSubscriberService($serviceId, $class)
|
||||
{
|
||||
@trigger_error(sprintf('The %s class is deprecated since version 3.3 and will be removed in 4.0. Use EventDispatcher with closure factories instead.', __CLASS__), E_USER_DEPRECATED);
|
||||
@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)) {
|
||||
if (\is_string($params)) {
|
||||
$this->listenerIds[$eventName][] = array($serviceId, $params, 0);
|
||||
} elseif (is_string($params[0])) {
|
||||
} elseif (\is_string($params[0])) {
|
||||
$this->listenerIds[$eventName][] = array($serviceId, $params[0], isset($params[1]) ? $params[1] : 0);
|
||||
} else {
|
||||
foreach ($params as $listener) {
|
||||
|
|
@ -177,7 +163,7 @@ class ContainerAwareEventDispatcher extends EventDispatcher
|
|||
|
||||
public function getContainer()
|
||||
{
|
||||
@trigger_error('The '.__METHOD__.'() method is deprecated since version 3.3 as its class will be removed in 4.0. Inject the container or the services you need in your listeners/subscribers instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.'() method is deprecated since Symfony 3.3 as its class will be removed in 4.0. Inject the container or the services you need in your listeners/subscribers instead.', E_USER_DEPRECATED);
|
||||
|
||||
return $this->container;
|
||||
}
|
||||
|
|
@ -199,7 +185,7 @@ class ContainerAwareEventDispatcher extends EventDispatcher
|
|||
$key = $serviceId.'.'.$method;
|
||||
if (!isset($this->listeners[$eventName][$key])) {
|
||||
$this->addListener($eventName, array($listener, $method), $priority);
|
||||
} elseif ($listener !== $this->listeners[$eventName][$key]) {
|
||||
} elseif ($this->listeners[$eventName][$key] !== $listener) {
|
||||
parent::removeListener($eventName, array($this->listeners[$eventName][$key], $method));
|
||||
$this->addListener($eventName, array($listener, $method), $priority);
|
||||
}
|
||||
|
|
|
|||
22
pfosten/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php
vendored
Executable file → Normal file
22
pfosten/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php
vendored
Executable file → Normal file
|
|
@ -11,11 +11,11 @@
|
|||
|
||||
namespace Symfony\Component\EventDispatcher\Debug;
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Component\Stopwatch\Stopwatch;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* Collects some data about event listeners.
|
||||
|
|
@ -33,13 +33,6 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
|
|||
private $dispatcher;
|
||||
private $wrappedListeners;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param EventDispatcherInterface $dispatcher An EventDispatcherInterface instance
|
||||
* @param Stopwatch $stopwatch A Stopwatch instance
|
||||
* @param LoggerInterface $logger A LoggerInterface instance
|
||||
*/
|
||||
public function __construct(EventDispatcherInterface $dispatcher, Stopwatch $stopwatch, LoggerInterface $logger = null)
|
||||
{
|
||||
$this->dispatcher = $dispatcher;
|
||||
|
|
@ -214,6 +207,11 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
|
|||
return $notCalled;
|
||||
}
|
||||
|
||||
public function reset()
|
||||
{
|
||||
$this->called = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Proxies all method calls to the original event dispatcher.
|
||||
*
|
||||
|
|
@ -224,7 +222,7 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
|
|||
*/
|
||||
public function __call($method, $arguments)
|
||||
{
|
||||
return call_user_func_array(array($this->dispatcher, $method), $arguments);
|
||||
return \call_user_func_array(array($this->dispatcher, $method), $arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -303,11 +301,11 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
|
|||
|
||||
private function sortListenersByPriority($a, $b)
|
||||
{
|
||||
if (is_int($a['priority']) && !is_int($b['priority'])) {
|
||||
if (\is_int($a['priority']) && !\is_int($b['priority'])) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!is_int($a['priority']) && is_int($b['priority'])) {
|
||||
if (!\is_int($a['priority']) && \is_int($b['priority'])) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php
vendored
Executable file → Normal file
|
|
@ -15,6 +15,8 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
|||
|
||||
/**
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* @method reset() Resets the trace.
|
||||
*/
|
||||
interface TraceableEventDispatcherInterface extends EventDispatcherInterface
|
||||
{
|
||||
|
|
|
|||
22
pfosten/vendor/symfony/event-dispatcher/Debug/WrappedListener.php
vendored
Executable file → Normal file
22
pfosten/vendor/symfony/event-dispatcher/Debug/WrappedListener.php
vendored
Executable file → Normal file
|
|
@ -11,11 +11,10 @@
|
|||
|
||||
namespace Symfony\Component\EventDispatcher\Debug;
|
||||
|
||||
use Symfony\Component\Stopwatch\Stopwatch;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\Stopwatch\Stopwatch;
|
||||
use Symfony\Component\VarDumper\Caster\ClassStub;
|
||||
use Symfony\Component\VarDumper\Cloner\VarCloner;
|
||||
|
||||
/**
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
|
|
@ -30,8 +29,7 @@ class WrappedListener
|
|||
private $dispatcher;
|
||||
private $pretty;
|
||||
private $stub;
|
||||
|
||||
private static $cloner;
|
||||
private static $hasClassStub;
|
||||
|
||||
public function __construct($listener, $name, Stopwatch $stopwatch, EventDispatcherInterface $dispatcher = null)
|
||||
{
|
||||
|
|
@ -42,15 +40,15 @@ class WrappedListener
|
|||
$this->called = false;
|
||||
$this->stoppedPropagation = false;
|
||||
|
||||
if (is_array($listener)) {
|
||||
$this->name = is_object($listener[0]) ? get_class($listener[0]) : $listener[0];
|
||||
if (\is_array($listener)) {
|
||||
$this->name = \is_object($listener[0]) ? \get_class($listener[0]) : $listener[0];
|
||||
$this->pretty = $this->name.'::'.$listener[1];
|
||||
} elseif ($listener instanceof \Closure) {
|
||||
$this->pretty = $this->name = 'closure';
|
||||
} elseif (is_string($listener)) {
|
||||
} elseif (\is_string($listener)) {
|
||||
$this->pretty = $this->name = $listener;
|
||||
} else {
|
||||
$this->name = get_class($listener);
|
||||
$this->name = \get_class($listener);
|
||||
$this->pretty = $this->name.'::__invoke';
|
||||
}
|
||||
|
||||
|
|
@ -58,8 +56,8 @@ class WrappedListener
|
|||
$this->name = $name;
|
||||
}
|
||||
|
||||
if (null === self::$cloner) {
|
||||
self::$cloner = class_exists(ClassStub::class) ? new VarCloner() : false;
|
||||
if (null === self::$hasClassStub) {
|
||||
self::$hasClassStub = class_exists(ClassStub::class);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -86,7 +84,7 @@ class WrappedListener
|
|||
public function getInfo($eventName)
|
||||
{
|
||||
if (null === $this->stub) {
|
||||
$this->stub = false === self::$cloner ? $this->pretty.'()' : new ClassStub($this->pretty.'()', $this->listener);
|
||||
$this->stub = self::$hasClassStub ? new ClassStub($this->pretty.'()', $this->listener) : $this->pretty.'()';
|
||||
}
|
||||
|
||||
return array(
|
||||
|
|
@ -103,7 +101,7 @@ class WrappedListener
|
|||
|
||||
$e = $this->stopwatch->start($this->name, 'event_listener');
|
||||
|
||||
call_user_func($this->listener, $event, $eventName, $this->dispatcher ?: $dispatcher);
|
||||
\call_user_func($this->listener, $event, $eventName, $this->dispatcher ?: $dispatcher);
|
||||
|
||||
if ($e->isStarted()) {
|
||||
$e->stop();
|
||||
|
|
|
|||
52
pfosten/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php
vendored
Executable file → Normal file
52
pfosten/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php
vendored
Executable file → Normal file
|
|
@ -12,8 +12,8 @@
|
|||
namespace Symfony\Component\EventDispatcher\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
|
|
@ -24,24 +24,14 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
|||
*/
|
||||
class RegisterListenersPass implements CompilerPassInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $dispatcherService;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $listenerTag;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $subscriberTag;
|
||||
|
||||
private $hotPathEvents = array();
|
||||
private $hotPathTagName;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $dispatcherService Service name of the event dispatcher in processed container
|
||||
* @param string $listenerTag Tag name used for listener
|
||||
* @param string $subscriberTag Tag name used for subscribers
|
||||
|
|
@ -53,6 +43,14 @@ class RegisterListenersPass implements CompilerPassInterface
|
|||
$this->subscriberTag = $subscriberTag;
|
||||
}
|
||||
|
||||
public function setHotPathEvents(array $hotPathEvents, $tagName = 'container.hot_path')
|
||||
{
|
||||
$this->hotPathEvents = array_flip($hotPathEvents);
|
||||
$this->hotPathTagName = $tagName;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->hasDefinition($this->dispatcherService) && !$container->hasAlias($this->dispatcherService)) {
|
||||
|
|
@ -62,8 +60,6 @@ class RegisterListenersPass implements CompilerPassInterface
|
|||
$definition = $container->findDefinition($this->dispatcherService);
|
||||
|
||||
foreach ($container->findTaggedServiceIds($this->listenerTag, true) as $id => $events) {
|
||||
$def = $container->getDefinition($id);
|
||||
|
||||
foreach ($events as $event) {
|
||||
$priority = isset($event['priority']) ? $event['priority'] : 0;
|
||||
|
||||
|
|
@ -80,6 +76,10 @@ class RegisterListenersPass implements CompilerPassInterface
|
|||
}
|
||||
|
||||
$definition->addMethodCall('addListener', array($event['event'], array(new ServiceClosureArgument(new Reference($id)), $event['method']), $priority));
|
||||
|
||||
if (isset($this->hotPathEvents[$event['event']])) {
|
||||
$container->getDefinition($id)->addTag($this->hotPathTagName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -89,23 +89,25 @@ class RegisterListenersPass implements CompilerPassInterface
|
|||
$def = $container->getDefinition($id);
|
||||
|
||||
// We must assume that the class value has been correctly filled, even if the service is created by a factory
|
||||
$class = $container->getParameterBag()->resolveValue($def->getClass());
|
||||
$interface = 'Symfony\Component\EventDispatcher\EventSubscriberInterface';
|
||||
$class = $def->getClass();
|
||||
|
||||
if (!is_subclass_of($class, $interface)) {
|
||||
if (!class_exists($class, false)) {
|
||||
throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
|
||||
}
|
||||
|
||||
throw new InvalidArgumentException(sprintf('Service "%s" must implement interface "%s".', $id, $interface));
|
||||
if (!$r = $container->getReflectionClass($class)) {
|
||||
throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
|
||||
}
|
||||
$container->addObjectResource($class);
|
||||
if (!$r->isSubclassOf(EventSubscriberInterface::class)) {
|
||||
throw new InvalidArgumentException(sprintf('Service "%s" must implement interface "%s".', $id, EventSubscriberInterface::class));
|
||||
}
|
||||
$class = $r->name;
|
||||
|
||||
ExtractingEventDispatcher::$subscriber = $class;
|
||||
$extractingDispatcher->addSubscriber($extractingDispatcher);
|
||||
foreach ($extractingDispatcher->listeners as $args) {
|
||||
$args[1] = array(new ServiceClosureArgument(new Reference($id)), $args[1]);
|
||||
$definition->addMethodCall('addListener', $args);
|
||||
|
||||
if (isset($this->hotPathEvents[$args[0]])) {
|
||||
$container->getDefinition($id)->addTag('container.hot_path');
|
||||
}
|
||||
}
|
||||
$extractingDispatcher->listeners = array();
|
||||
}
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/event-dispatcher/Event.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/event-dispatcher/Event.php
vendored
Executable file → Normal file
20
pfosten/vendor/symfony/event-dispatcher/EventDispatcher.php
vendored
Executable file → Normal file
20
pfosten/vendor/symfony/event-dispatcher/EventDispatcher.php
vendored
Executable file → Normal file
|
|
@ -82,13 +82,13 @@ class EventDispatcher implements EventDispatcherInterface
|
|||
return;
|
||||
}
|
||||
|
||||
if (is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure) {
|
||||
if (\is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure) {
|
||||
$listener[0] = $listener[0]();
|
||||
}
|
||||
|
||||
foreach ($this->listeners[$eventName] as $priority => $listeners) {
|
||||
foreach ($listeners as $k => $v) {
|
||||
if ($v !== $listener && is_array($v) && isset($v[0]) && $v[0] instanceof \Closure) {
|
||||
if ($v !== $listener && \is_array($v) && isset($v[0]) && $v[0] instanceof \Closure) {
|
||||
$v[0] = $v[0]();
|
||||
$this->listeners[$eventName][$priority][$k] = $v;
|
||||
}
|
||||
|
|
@ -135,13 +135,13 @@ class EventDispatcher implements EventDispatcherInterface
|
|||
return;
|
||||
}
|
||||
|
||||
if (is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure) {
|
||||
if (\is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure) {
|
||||
$listener[0] = $listener[0]();
|
||||
}
|
||||
|
||||
foreach ($this->listeners[$eventName] as $priority => $listeners) {
|
||||
foreach ($listeners as $k => $v) {
|
||||
if ($v !== $listener && is_array($v) && isset($v[0]) && $v[0] instanceof \Closure) {
|
||||
if ($v !== $listener && \is_array($v) && isset($v[0]) && $v[0] instanceof \Closure) {
|
||||
$v[0] = $v[0]();
|
||||
}
|
||||
if ($v === $listener) {
|
||||
|
|
@ -165,9 +165,9 @@ class EventDispatcher implements EventDispatcherInterface
|
|||
public function addSubscriber(EventSubscriberInterface $subscriber)
|
||||
{
|
||||
foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
|
||||
if (is_string($params)) {
|
||||
if (\is_string($params)) {
|
||||
$this->addListener($eventName, array($subscriber, $params));
|
||||
} elseif (is_string($params[0])) {
|
||||
} elseif (\is_string($params[0])) {
|
||||
$this->addListener($eventName, array($subscriber, $params[0]), isset($params[1]) ? $params[1] : 0);
|
||||
} else {
|
||||
foreach ($params as $listener) {
|
||||
|
|
@ -183,12 +183,12 @@ class EventDispatcher implements EventDispatcherInterface
|
|||
public function removeSubscriber(EventSubscriberInterface $subscriber)
|
||||
{
|
||||
foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
|
||||
if (is_array($params) && is_array($params[0])) {
|
||||
if (\is_array($params) && \is_array($params[0])) {
|
||||
foreach ($params as $listener) {
|
||||
$this->removeListener($eventName, array($subscriber, $listener[0]));
|
||||
}
|
||||
} else {
|
||||
$this->removeListener($eventName, array($subscriber, is_string($params) ? $params : $params[0]));
|
||||
$this->removeListener($eventName, array($subscriber, \is_string($params) ? $params : $params[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -209,7 +209,7 @@ class EventDispatcher implements EventDispatcherInterface
|
|||
if ($event->isPropagationStopped()) {
|
||||
break;
|
||||
}
|
||||
call_user_func($listener, $event, $eventName, $this);
|
||||
\call_user_func($listener, $event, $eventName, $this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -225,7 +225,7 @@ class EventDispatcher implements EventDispatcherInterface
|
|||
|
||||
foreach ($this->listeners[$eventName] as $priority => $listeners) {
|
||||
foreach ($listeners as $k => $listener) {
|
||||
if (is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure) {
|
||||
if (\is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure) {
|
||||
$listener[0] = $listener[0]();
|
||||
$this->listeners[$eventName][$priority][$k] = $listener;
|
||||
}
|
||||
|
|
|
|||
9
pfosten/vendor/symfony/event-dispatcher/EventDispatcherInterface.php
vendored
Executable file → Normal file
9
pfosten/vendor/symfony/event-dispatcher/EventDispatcherInterface.php
vendored
Executable file → Normal file
|
|
@ -27,7 +27,7 @@ interface EventDispatcherInterface
|
|||
* the event is the name of the method that is
|
||||
* invoked on listeners.
|
||||
* @param Event $event The event to pass to the event handlers/listeners
|
||||
* If not supplied, an empty Event instance is created.
|
||||
* If not supplied, an empty Event instance is created
|
||||
*
|
||||
* @return Event
|
||||
*/
|
||||
|
|
@ -48,8 +48,6 @@ interface EventDispatcherInterface
|
|||
*
|
||||
* The subscriber is asked for all the events he is
|
||||
* interested in and added as a listener for these events.
|
||||
*
|
||||
* @param EventSubscriberInterface $subscriber The subscriber
|
||||
*/
|
||||
public function addSubscriber(EventSubscriberInterface $subscriber);
|
||||
|
||||
|
|
@ -61,11 +59,6 @@ interface EventDispatcherInterface
|
|||
*/
|
||||
public function removeListener($eventName, $listener);
|
||||
|
||||
/**
|
||||
* Removes an event subscriber.
|
||||
*
|
||||
* @param EventSubscriberInterface $subscriber The subscriber
|
||||
*/
|
||||
public function removeSubscriber(EventSubscriberInterface $subscriber);
|
||||
|
||||
/**
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/event-dispatcher/EventSubscriberInterface.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/event-dispatcher/EventSubscriberInterface.php
vendored
Executable file → Normal file
17
pfosten/vendor/symfony/event-dispatcher/GenericEvent.php
vendored
Executable file → Normal file
17
pfosten/vendor/symfony/event-dispatcher/GenericEvent.php
vendored
Executable file → Normal file
|
|
@ -20,24 +20,13 @@ namespace Symfony\Component\EventDispatcher;
|
|||
*/
|
||||
class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate
|
||||
{
|
||||
/**
|
||||
* Event subject.
|
||||
*
|
||||
* @var mixed usually object or callable
|
||||
*/
|
||||
protected $subject;
|
||||
|
||||
/**
|
||||
* Array of arguments.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $arguments;
|
||||
|
||||
/**
|
||||
* Encapsulate an event with $subject and $args.
|
||||
*
|
||||
* @param mixed $subject The subject of the event, usually an object
|
||||
* @param mixed $subject The subject of the event, usually an object or a callable
|
||||
* @param array $arguments Arguments to store in the event
|
||||
*/
|
||||
public function __construct($subject = null, array $arguments = array())
|
||||
|
|
@ -63,7 +52,7 @@ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate
|
|||
*
|
||||
* @return mixed Contents of array key
|
||||
*
|
||||
* @throws \InvalidArgumentException If key is not found.
|
||||
* @throws \InvalidArgumentException if key is not found
|
||||
*/
|
||||
public function getArgument($key)
|
||||
{
|
||||
|
|
@ -132,7 +121,7 @@ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate
|
|||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \InvalidArgumentException If key does not exist in $this->args.
|
||||
* @throws \InvalidArgumentException if key does not exist in $this->args
|
||||
*/
|
||||
public function offsetGet($key)
|
||||
{
|
||||
|
|
|
|||
10
pfosten/vendor/symfony/event-dispatcher/ImmutableEventDispatcher.php
vendored
Executable file → Normal file
10
pfosten/vendor/symfony/event-dispatcher/ImmutableEventDispatcher.php
vendored
Executable file → Normal file
|
|
@ -18,18 +18,8 @@ namespace Symfony\Component\EventDispatcher;
|
|||
*/
|
||||
class ImmutableEventDispatcher implements EventDispatcherInterface
|
||||
{
|
||||
/**
|
||||
* The proxied dispatcher.
|
||||
*
|
||||
* @var EventDispatcherInterface
|
||||
*/
|
||||
private $dispatcher;
|
||||
|
||||
/**
|
||||
* Creates an unmodifiable proxy for an event dispatcher.
|
||||
*
|
||||
* @param EventDispatcherInterface $dispatcher The proxied event dispatcher
|
||||
*/
|
||||
public function __construct(EventDispatcherInterface $dispatcher)
|
||||
{
|
||||
$this->dispatcher = $dispatcher;
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/event-dispatcher/LICENSE
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/event-dispatcher/LICENSE
vendored
Executable file → Normal file
|
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2004-2017 Fabien Potencier
|
||||
Copyright (c) 2004-2018 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/event-dispatcher/README.md
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/event-dispatcher/README.md
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php
vendored
Executable file → Normal file
|
|
@ -158,7 +158,7 @@ abstract class AbstractEventDispatcherTest extends TestCase
|
|||
// be executed
|
||||
// Manually set priority to enforce $this->listener to be called first
|
||||
$this->dispatcher->addListener('post.foo', array($this->listener, 'postFoo'), 10);
|
||||
$this->dispatcher->addListener('post.foo', array($otherListener, 'preFoo'));
|
||||
$this->dispatcher->addListener('post.foo', array($otherListener, 'postFoo'));
|
||||
$this->dispatcher->dispatch(self::postFoo);
|
||||
$this->assertTrue($this->listener->postFooInvoked);
|
||||
$this->assertFalse($otherListener->postFooInvoked);
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/event-dispatcher/Tests/ContainerAwareEventDispatcherTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/event-dispatcher/Tests/ContainerAwareEventDispatcherTest.php
vendored
Executable file → Normal file
|
|
@ -143,7 +143,7 @@ class ContainerAwareEventDispatcherTest extends AbstractEventDispatcherTest
|
|||
|
||||
$listeners = $dispatcher->getListeners();
|
||||
|
||||
$this->assertTrue(isset($listeners['onEvent']));
|
||||
$this->assertArrayHasKey('onEvent', $listeners);
|
||||
|
||||
$this->assertCount(1, $dispatcher->getListeners('onEvent'));
|
||||
}
|
||||
|
|
|
|||
19
pfosten/vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php
vendored
Executable file → Normal file
19
pfosten/vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php
vendored
Executable file → Normal file
|
|
@ -13,10 +13,10 @@ namespace Symfony\Component\EventDispatcher\Tests\Debug;
|
|||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Component\Stopwatch\Stopwatch;
|
||||
|
||||
class TraceableEventDispatcherTest extends TestCase
|
||||
|
|
@ -124,6 +124,21 @@ class TraceableEventDispatcherTest extends TestCase
|
|||
$this->assertEquals(array(), $tdispatcher->getNotCalledListeners());
|
||||
}
|
||||
|
||||
public function testClearCalledListeners()
|
||||
{
|
||||
$tdispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
|
||||
$tdispatcher->addListener('foo', function () {}, 5);
|
||||
|
||||
$tdispatcher->dispatch('foo');
|
||||
$tdispatcher->reset();
|
||||
|
||||
$listeners = $tdispatcher->getNotCalledListeners();
|
||||
$this->assertArrayHasKey('stub', $listeners['foo.closure']);
|
||||
unset($listeners['foo.closure']['stub']);
|
||||
$this->assertEquals(array(), $tdispatcher->getCalledListeners());
|
||||
$this->assertEquals(array('foo.closure' => array('event' => 'foo', 'pretty' => 'closure', 'priority' => 5)), $listeners);
|
||||
}
|
||||
|
||||
public function testGetCalledListenersNested()
|
||||
{
|
||||
$tdispatcher = null;
|
||||
|
|
|
|||
77
pfosten/vendor/symfony/event-dispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php
vendored
Executable file → Normal file
77
pfosten/vendor/symfony/event-dispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php
vendored
Executable file → Normal file
|
|
@ -27,29 +27,10 @@ class RegisterListenersPassTest extends TestCase
|
|||
*/
|
||||
public function testEventSubscriberWithoutInterface()
|
||||
{
|
||||
// one service, not implementing any interface
|
||||
$services = array(
|
||||
'my_event_subscriber' => array(0 => array()),
|
||||
);
|
||||
|
||||
$definition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->getMock();
|
||||
$definition->expects($this->atLeastOnce())
|
||||
->method('getClass')
|
||||
->will($this->returnValue('stdClass'));
|
||||
|
||||
$builder = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('hasDefinition', 'findTaggedServiceIds', 'getDefinition'))->getMock();
|
||||
$builder->expects($this->any())
|
||||
->method('hasDefinition')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
// We don't test kernel.event_listener here
|
||||
$builder->expects($this->atLeastOnce())
|
||||
->method('findTaggedServiceIds')
|
||||
->will($this->onConsecutiveCalls(array(), $services));
|
||||
|
||||
$builder->expects($this->atLeastOnce())
|
||||
->method('getDefinition')
|
||||
->will($this->returnValue($definition));
|
||||
$builder = new ContainerBuilder();
|
||||
$builder->register('event_dispatcher');
|
||||
$builder->register('my_event_subscriber', 'stdClass')
|
||||
->addTag('kernel.event_subscriber');
|
||||
|
||||
$registerListenersPass = new RegisterListenersPass();
|
||||
$registerListenersPass->process($builder);
|
||||
|
|
@ -61,31 +42,25 @@ class RegisterListenersPassTest extends TestCase
|
|||
'my_event_subscriber' => array(0 => array()),
|
||||
);
|
||||
|
||||
$definition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->getMock();
|
||||
$definition->expects($this->atLeastOnce())
|
||||
->method('getClass')
|
||||
->will($this->returnValue('Symfony\Component\EventDispatcher\Tests\DependencyInjection\SubscriberService'));
|
||||
|
||||
$builder = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('hasDefinition', 'findTaggedServiceIds', 'getDefinition', 'findDefinition'))->getMock();
|
||||
$builder->expects($this->any())
|
||||
->method('hasDefinition')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
// We don't test kernel.event_listener here
|
||||
$builder->expects($this->atLeastOnce())
|
||||
->method('findTaggedServiceIds')
|
||||
->will($this->onConsecutiveCalls(array(), $services));
|
||||
|
||||
$builder->expects($this->atLeastOnce())
|
||||
->method('getDefinition')
|
||||
->will($this->returnValue($definition));
|
||||
|
||||
$builder->expects($this->atLeastOnce())
|
||||
->method('findDefinition')
|
||||
->will($this->returnValue($definition));
|
||||
$builder = new ContainerBuilder();
|
||||
$eventDispatcherDefinition = $builder->register('event_dispatcher');
|
||||
$builder->register('my_event_subscriber', 'Symfony\Component\EventDispatcher\Tests\DependencyInjection\SubscriberService')
|
||||
->addTag('kernel.event_subscriber');
|
||||
|
||||
$registerListenersPass = new RegisterListenersPass();
|
||||
$registerListenersPass->process($builder);
|
||||
|
||||
$expectedCalls = array(
|
||||
array(
|
||||
'addListener',
|
||||
array(
|
||||
'event',
|
||||
array(new ServiceClosureArgument(new Reference('my_event_subscriber')), 'onEvent'),
|
||||
0,
|
||||
),
|
||||
),
|
||||
);
|
||||
$this->assertEquals($expectedCalls, $eventDispatcherDefinition->getMethodCalls());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -141,6 +116,18 @@ class RegisterListenersPassTest extends TestCase
|
|||
$this->assertEquals($expectedCalls, $definition->getMethodCalls());
|
||||
}
|
||||
|
||||
public function testHotPathEvents()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
|
||||
$container->register('foo', SubscriberService::class)->addTag('kernel.event_subscriber', array());
|
||||
$container->register('event_dispatcher', 'stdClass');
|
||||
|
||||
(new RegisterListenersPass())->setHotPathEvents(array('event'))->process($container);
|
||||
|
||||
$this->assertTrue($container->getDefinition('foo')->hasTag('container.hot_path'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage You have requested a non-existent parameter "subscriber.class"
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/event-dispatcher/Tests/EventDispatcherTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/event-dispatcher/Tests/EventDispatcherTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/event-dispatcher/Tests/EventTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/event-dispatcher/Tests/EventTest.php
vendored
Executable file → Normal file
4
pfosten/vendor/symfony/event-dispatcher/Tests/GenericEventTest.php
vendored
Executable file → Normal file
4
pfosten/vendor/symfony/event-dispatcher/Tests/GenericEventTest.php
vendored
Executable file → Normal file
|
|
@ -114,8 +114,8 @@ class GenericEventTest extends TestCase
|
|||
|
||||
public function testOffsetIsset()
|
||||
{
|
||||
$this->assertTrue(isset($this->event['name']));
|
||||
$this->assertFalse(isset($this->event['nameNotExist']));
|
||||
$this->assertArrayHasKey('name', $this->event);
|
||||
$this->assertArrayNotHasKey('nameNotExist', $this->event);
|
||||
}
|
||||
|
||||
public function testHasArgument()
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/event-dispatcher/Tests/ImmutableEventDispatcherTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/event-dispatcher/Tests/ImmutableEventDispatcherTest.php
vendored
Executable file → Normal file
12
pfosten/vendor/symfony/event-dispatcher/composer.json
vendored
Executable file → Normal file
12
pfosten/vendor/symfony/event-dispatcher/composer.json
vendored
Executable file → Normal file
|
|
@ -16,13 +16,13 @@
|
|||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.5.9"
|
||||
"php": "^5.5.9|>=7.0.8"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/dependency-injection": "~3.3",
|
||||
"symfony/expression-language": "~2.8|~3.0",
|
||||
"symfony/config": "~2.8|~3.0",
|
||||
"symfony/stopwatch": "~2.8|~3.0",
|
||||
"symfony/dependency-injection": "~3.3|~4.0",
|
||||
"symfony/expression-language": "~2.8|~3.0|~4.0",
|
||||
"symfony/config": "~2.8|~3.0|~4.0",
|
||||
"symfony/stopwatch": "~2.8|~3.0|~4.0",
|
||||
"psr/log": "~1.0"
|
||||
},
|
||||
"conflict": {
|
||||
|
|
@ -41,7 +41,7 @@
|
|||
"minimum-stability": "dev",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.3-dev"
|
||||
"dev-master": "3.4-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/event-dispatcher/phpunit.xml.dist
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/event-dispatcher/phpunit.xml.dist
vendored
Executable file → Normal file
Loading…
Add table
Add a link
Reference in a new issue