diff --git a/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php index 02ffd902254e0..1910ec66a25c6 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php @@ -108,7 +108,8 @@ private function findClasses($namespace, $pattern) if (!$r = $this->container->getReflectionClass($class)) { throw new InvalidArgumentException(sprintf('Expected to find class "%s" in file "%s" while importing services from resource "%s", but it was not found! Check the namespace prefix used with the resource.', $class, $path, $pattern)); } - if (!$r->isInterface() && !$r->isTrait()) { + + if (!$r->isInterface() && !$r->isTrait() && !$r->isAbstract()) { $classes[] = $class; } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Prototype/Sub/NoLoadAbstractBar.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Prototype/Sub/NoLoadAbstractBar.php new file mode 100644 index 0000000000000..0b72234aae7a6 --- /dev/null +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Prototype/Sub/NoLoadAbstractBar.php @@ -0,0 +1,7 @@ +registerClasses(new Definition(), 'Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub\\', 'Prototype/%sub_dir%/*'); - $this->assertTrue($container->has(Bar::class)); + $this->assertEquals( + array('service_container', Bar::class), + array_keys($container->getDefinitions()) + ); } /**