diff --git a/extension.neon b/extension.neon index e09d9779..cf080067 100644 --- a/extension.neon +++ b/extension.neon @@ -12,7 +12,7 @@ services: class: PHPStan\Symfony\ServiceMapFactory factory: PHPStan\Symfony\XmlServiceMapFactory(%symfony.container_xml_path%) - - class: PHPStan\Symfony\ServiceMap(@symfony.serviceMapFactory::create()) + class: @symfony.serviceMapFactory::create() # ControllerTrait::get()/has() return type - diff --git a/tests/Symfony/NeonTest.php b/tests/Symfony/NeonTest.php index ad73f9a0..a6fec3f8 100644 --- a/tests/Symfony/NeonTest.php +++ b/tests/Symfony/NeonTest.php @@ -24,6 +24,7 @@ public function testExtensionNeon(): void $class = $loader->load(function (Compiler $compiler): void { $compiler->addExtension('rules', new RulesExtension()); + $compiler->addConfig(['parameters' => ['rootDir' => __DIR__]]); $compiler->loadConfig(__DIR__ . '/config.neon'); $compiler->loadConfig(__DIR__ . '/../../extension.neon'); }, $key); @@ -31,8 +32,9 @@ public function testExtensionNeon(): void $container = new $class(); self::assertSame([ + 'rootDir' => __DIR__, 'symfony' => [ - 'container_xml_path' => '', + 'container_xml_path' => __DIR__ . '/container.xml', 'constant_hassers' => true, ], ], $container->getParameters()); @@ -40,6 +42,7 @@ public function testExtensionNeon(): void self::assertCount(2, $container->findByTag('phpstan.rules.rule')); self::assertCount(4, $container->findByTag('phpstan.broker.dynamicMethodReturnTypeExtension')); self::assertCount(3, $container->findByTag('phpstan.typeSpecifier.methodTypeSpecifyingExtension')); + self::assertInstanceOf(ServiceMap::class, $container->getByType(ServiceMap::class)); } } diff --git a/tests/Symfony/config.neon b/tests/Symfony/config.neon index 22bbecd2..d5787020 100644 --- a/tests/Symfony/config.neon +++ b/tests/Symfony/config.neon @@ -1,6 +1,6 @@ parameters: symfony: - container_xml_path: '' + container_xml_path: %rootDir%/container.xml services: - PhpParser\PrettyPrinter\Standard