diff --git a/DependencyInjection/Compiler/CustomProcessorPass.php b/DependencyInjection/Compiler/CustomProcessorPass.php index 6fc872a11..9bbf77614 100644 --- a/DependencyInjection/Compiler/CustomProcessorPass.php +++ b/DependencyInjection/Compiler/CustomProcessorPass.php @@ -42,19 +42,19 @@ public function process(ContainerBuilder $container): void $definitions[$id] = $definition; } - // If the ApiDocGenerator service is not defined, then there is nothing to do - if (!$container->has(ApiDocGenerator::class)) { + // If there are no definitions, we can stop here. + if (empty($definitions)) { return; } - $definition = $container->getDefinition(ApiDocGenerator::class); - $processors = []; foreach ($container->findTaggedServiceIds('swagger.processor') as $id => $tags) { $processors[] = $id; } - foreach($processors as $processor) { - $definition->addMethodCall('registerProcessor', [$processor]); + foreach( $definitions as $definition ) { + foreach($processors as $processor) { + $definition->addMethodCall('registerProcessor', [$processor]); + } } } }