Skip to content

Commit

Permalink
Merge branch '3.4' into 4.0
Browse files Browse the repository at this point in the history
* 3.4:
  Fix lock strategy tests
  [travis] cache compiled php extensions
  fix merge
  Allow remember-me factory creation when multiple user providers are configured.
  Add tests for glob loaders
  Improve assertions
  [DI][Routing] Fix tracking of globbed resources
  [Config] Handle Service/EventSubscriberInterface in ReflectionClassResource
  always call the parent class' constructor
  • Loading branch information
nicolas-grekas committed Feb 4, 2018
2 parents 74d33aa + 9e34a7a commit fe89431
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions DependencyInjection/RegisterListenersPass.php
Expand Up @@ -84,17 +84,15 @@ public function process(ContainerBuilder $container)
$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));
}
if (!$r->isSubclassOf(EventSubscriberInterface::class)) {
throw new InvalidArgumentException(sprintf('Service "%s" must implement interface "%s".', $id, EventSubscriberInterface::class));
}
$container->addObjectResource($class);
$class = $r->name;

ExtractingEventDispatcher::$subscriber = $class;
$extractingDispatcher->addSubscriber($extractingDispatcher);
Expand Down

0 comments on commit fe89431

Please sign in to comment.