Skip to content

Commit

Permalink
Merge pull request #15 from nextcloud/symfony_event_dispatcher_bump
Browse files Browse the repository at this point in the history
Bump symfony/event-dispatcher
  • Loading branch information
MorrisJobke committed Sep 9, 2016
2 parents 2c77c4a + 3ac3ad5 commit f5555fe
Show file tree
Hide file tree
Showing 11 changed files with 130 additions and 185 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -19,7 +19,7 @@
"pear/archive_tar": "1.4.1",
"patchwork/utf8": "1.2.6",
"symfony/console": "^3.0.0",
"symfony/event-dispatcher": "2.8.3",
"symfony/event-dispatcher": "^3.0.0",
"symfony/routing": "^3.0.0",
"symfony/process": "2.8.1",
"pimple/pimple": "3.0.2",
Expand Down
26 changes: 13 additions & 13 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 62 additions & 62 deletions composer/installed.json
Expand Up @@ -2035,68 +2035,6 @@
"xml"
]
},
{
"name": "symfony/event-dispatcher",
"version": "v2.8.3",
"version_normalized": "2.8.3.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
"reference": "78c468665c9568c3faaa9c416a7134308f2d85c3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/78c468665c9568c3faaa9c416a7134308f2d85c3",
"reference": "78c468665c9568c3faaa9c416a7134308f2d85c3",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
},
"require-dev": {
"psr/log": "~1.0",
"symfony/config": "~2.0,>=2.0.5|~3.0.0",
"symfony/dependency-injection": "~2.6|~3.0.0",
"symfony/expression-language": "~2.6|~3.0.0",
"symfony/stopwatch": "~2.3|~3.0.0"
},
"suggest": {
"symfony/dependency-injection": "",
"symfony/http-kernel": ""
},
"time": "2016-01-27 05:14:19",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.8-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Component\\EventDispatcher\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com"
},
{
"name": "paragonie/random_compat",
"version": "v1.4.1",
Expand Down Expand Up @@ -2852,5 +2790,67 @@
"x.509",
"x509"
]
},
{
"name": "symfony/event-dispatcher",
"version": "v3.1.4",
"version_normalized": "3.1.4.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
"reference": "c0c00c80b3a69132c4e55c3e7db32b4a387615e5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/c0c00c80b3a69132c4e55c3e7db32b4a387615e5",
"reference": "c0c00c80b3a69132c4e55c3e7db32b4a387615e5",
"shasum": ""
},
"require": {
"php": ">=5.5.9"
},
"require-dev": {
"psr/log": "~1.0",
"symfony/config": "~2.8|~3.0",
"symfony/dependency-injection": "~2.8|~3.0",
"symfony/expression-language": "~2.8|~3.0",
"symfony/stopwatch": "~2.8|~3.0"
},
"suggest": {
"symfony/dependency-injection": "",
"symfony/http-kernel": ""
},
"time": "2016-07-19 10:45:57",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.1-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Component\\EventDispatcher\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com"
}
]
6 changes: 2 additions & 4 deletions symfony/event-dispatcher/ContainerAwareEventDispatcher.php
Expand Up @@ -80,8 +80,7 @@ public function removeListener($eventName, $listener)
$this->lazyLoad($eventName);

if (isset($this->listenerIds[$eventName])) {
foreach ($this->listenerIds[$eventName] as $i => $args) {
list($serviceId, $method, $priority) = $args;
foreach ($this->listenerIds[$eventName] as $i => list($serviceId, $method, $priority)) {
$key = $serviceId.'.'.$method;
if (isset($this->listeners[$eventName][$key]) && $listener === array($this->listeners[$eventName][$key], $method)) {
unset($this->listeners[$eventName][$key]);
Expand Down Expand Up @@ -178,8 +177,7 @@ public function getContainer()
protected function lazyLoad($eventName)
{
if (isset($this->listenerIds[$eventName])) {
foreach ($this->listenerIds[$eventName] as $args) {
list($serviceId, $method, $priority) = $args;
foreach ($this->listenerIds[$eventName] as list($serviceId, $method, $priority)) {
$listener = $this->container->get($serviceId);

$key = $serviceId.'.'.$method;
Expand Down
10 changes: 7 additions & 3 deletions symfony/event-dispatcher/Debug/TraceableEventDispatcher.php
Expand Up @@ -124,6 +124,10 @@ public function dispatch($eventName, Event $event = null)
$event = new Event();
}

if (null !== $this->logger && $event->isPropagationStopped()) {
$this->logger->debug(sprintf('The "%s" event is already stopped. No listeners have been called.', $eventName));
}

$this->preProcess($eventName);
$this->preDispatch($eventName, $event);

Expand Down Expand Up @@ -260,7 +264,7 @@ private function postProcess($eventName)
$info = $this->getListenerInfo($listener->getWrappedListener(), $eventName);
if ($listener->wasCalled()) {
if (null !== $this->logger) {
$this->logger->debug(sprintf('Notified event "%s" to listener "%s".', $eventName, $info['pretty']));
$this->logger->debug('Notified event "{event}" to listener "{listener}".', array('event' => $eventName, 'listener' => $info['pretty']));
}

if (!isset($this->called[$eventName])) {
Expand All @@ -271,12 +275,12 @@ private function postProcess($eventName)
}

if (null !== $this->logger && $skipped) {
$this->logger->debug(sprintf('Listener "%s" was not called for event "%s".', $info['pretty'], $eventName));
$this->logger->debug('Listener "{listener}" was not called for event "{event}".', array('listener' => $info['pretty'], 'event' => $eventName));
}

if ($listener->stoppedPropagation()) {
if (null !== $this->logger) {
$this->logger->debug(sprintf('Listener "%s" stopped propagation of the event "%s".', $info['pretty'], $eventName));
$this->logger->debug('Listener "{listener}" stopped propagation of the event "{event}".', array('listener' => $info['pretty'], 'event' => $eventName));
}

$skipped = true;
Expand Down
Expand Up @@ -97,10 +97,13 @@ public function process(ContainerBuilder $container)

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

$refClass = new \ReflectionClass($class);
$interface = 'Symfony\Component\EventDispatcher\EventSubscriberInterface';
if (!$refClass->implementsInterface($interface)) {

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

Expand Down
64 changes: 1 addition & 63 deletions symfony/event-dispatcher/Event.php
Expand Up @@ -32,22 +32,12 @@ class Event
*/
private $propagationStopped = false;

/**
* @var EventDispatcher Dispatcher that dispatched this event
*/
private $dispatcher;

/**
* @var string This event's name
*/
private $name;

/**
* Returns whether further event listeners should be triggered.
*
* @see Event::stopPropagation()
*
* @return bool Whether propagation was already stopped for this event.
* @return bool Whether propagation was already stopped for this event
*/
public function isPropagationStopped()
{
Expand All @@ -65,56 +55,4 @@ public function stopPropagation()
{
$this->propagationStopped = true;
}

/**
* Stores the EventDispatcher that dispatches this Event.
*
* @param EventDispatcherInterface $dispatcher
*
* @deprecated since version 2.4, to be removed in 3.0. The event dispatcher is passed to the listener call.
*/
public function setDispatcher(EventDispatcherInterface $dispatcher)
{
$this->dispatcher = $dispatcher;
}

/**
* Returns the EventDispatcher that dispatches this Event.
*
* @return EventDispatcherInterface
*
* @deprecated since version 2.4, to be removed in 3.0. The event dispatcher is passed to the listener call.
*/
public function getDispatcher()
{
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0. The event dispatcher instance can be received in the listener call instead.', E_USER_DEPRECATED);

return $this->dispatcher;
}

/**
* Gets the event's name.
*
* @return string
*
* @deprecated since version 2.4, to be removed in 3.0. The event name is passed to the listener call.
*/
public function getName()
{
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0. The event name can be received in the listener call instead.', E_USER_DEPRECATED);

return $this->name;
}

/**
* Sets the event's name property.
*
* @param string $name The event name.
*
* @deprecated since version 2.4, to be removed in 3.0. The event name is passed to the listener call.
*/
public function setName($name)
{
$this->name = $name;
}
}

0 comments on commit f5555fe

Please sign in to comment.