updated packages

This commit is contained in:
2019-05-18 09:06:43 +00:00
parent 901d16349e
commit e9487fa58a
2025 changed files with 30366 additions and 49653 deletions

View File

@@ -28,7 +28,7 @@ class RegisterListenersPass implements CompilerPassInterface
protected $listenerTag;
protected $subscriberTag;
private $hotPathEvents = array();
private $hotPathEvents = [];
private $hotPathTagName;
public function __construct(string $dispatcherService = 'event_dispatcher', string $listenerTag = 'kernel.event_listener', string $subscriberTag = 'kernel.event_subscriber')
@@ -63,10 +63,10 @@ class RegisterListenersPass implements CompilerPassInterface
}
if (!isset($event['method'])) {
$event['method'] = 'on'.preg_replace_callback(array(
$event['method'] = 'on'.preg_replace_callback([
'/(?<=\b)[a-z]/i',
'/[^a-z0-9]/i',
), function ($matches) { return strtoupper($matches[0]); }, $event['event']);
], function ($matches) { return strtoupper($matches[0]); }, $event['event']);
$event['method'] = preg_replace('/[^a-z0-9]/i', '', $event['method']);
if (null !== ($class = $container->getDefinition($id)->getClass()) && ($r = $container->getReflectionClass($class, false)) && !$r->hasMethod($event['method']) && $r->hasMethod('__invoke')) {
@@ -74,7 +74,7 @@ class RegisterListenersPass implements CompilerPassInterface
}
}
$definition->addMethodCall('addListener', array($event['event'], array(new ServiceClosureArgument(new Reference($id)), $event['method']), $priority));
$definition->addMethodCall('addListener', [$event['event'], [new ServiceClosureArgument(new Reference($id)), $event['method']], $priority]);
if (isset($this->hotPathEvents[$event['event']])) {
$container->getDefinition($id)->addTag($this->hotPathTagName);
@@ -101,14 +101,14 @@ class RegisterListenersPass implements CompilerPassInterface
ExtractingEventDispatcher::$subscriber = $class;
$extractingDispatcher->addSubscriber($extractingDispatcher);
foreach ($extractingDispatcher->listeners as $args) {
$args[1] = array(new ServiceClosureArgument(new Reference($id)), $args[1]);
$args[1] = [new ServiceClosureArgument(new Reference($id)), $args[1]];
$definition->addMethodCall('addListener', $args);
if (isset($this->hotPathEvents[$args[0]])) {
$container->getDefinition($id)->addTag('container.hot_path');
$container->getDefinition($id)->addTag($this->hotPathTagName);
}
}
$extractingDispatcher->listeners = array();
$extractingDispatcher->listeners = [];
}
}
}
@@ -118,18 +118,18 @@ class RegisterListenersPass implements CompilerPassInterface
*/
class ExtractingEventDispatcher extends EventDispatcher implements EventSubscriberInterface
{
public $listeners = array();
public $listeners = [];
public static $subscriber;
public function addListener($eventName, $listener, $priority = 0)
{
$this->listeners[] = array($eventName, $listener[1], $priority);
$this->listeners[] = [$eventName, $listener[1], $priority];
}
public static function getSubscribedEvents()
{
$callback = array(self::$subscriber, 'getSubscribedEvents');
$callback = [self::$subscriber, 'getSubscribedEvents'];
return $callback();
}