From 2d983ce67b9eb7e18403ae7bc5e765f8ce7b8d56 Mon Sep 17 00:00:00 2001 From: Max Stegmeyer <40475653+mstegmeyer@users.noreply.github.com> Date: Fri, 7 Jun 2024 00:42:02 +0200 Subject: [PATCH] Fix nullable processor call (#1604) --- src/Generator.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Generator.php b/src/Generator.php index c59146de..36953a53 100644 --- a/src/Generator.php +++ b/src/Generator.php @@ -286,7 +286,7 @@ public function getProcessorPipeline(): Pipeline return $this->processorPipeline->walk($walker); } - public function setProcessorPipeline(Pipeline $processor): Generator + public function setProcessorPipeline(?Pipeline $processor): Generator { $this->processorPipeline = $processor; @@ -427,13 +427,15 @@ public static function scan(iterable $sources, array $options = []): ?OA\OpenApi 'version' => null, ]; + $processorPipeline = $config['processor'] ?? + $config['processors'] ? new Pipeline($config['processors']) : null; + return (new Generator($config['logger'])) ->setVersion($config['version']) ->setAliases($config['aliases']) ->setNamespaces($config['namespaces']) ->setAnalyser($config['analyser']) - ->setProcessorPipeline($config['processor']) - ->setProcessorPipeline(new Pipeline($config['processors'])) + ->setProcessorPipeline($processorPipeline) ->generate($sources, $config['analysis'], $config['validate']); }