This commit is contained in:
Torsten 2018-08-07 10:42:11 +02:00
parent 98419bd18d
commit 8a69e45efa
4919 changed files with 28311 additions and 224136 deletions

View 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;
}

View 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
View 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();