Skip to content

Commit

Permalink
Fix nullable processor call (#1604)
Browse files Browse the repository at this point in the history
  • Loading branch information
mstegmeyer authored Jun 6, 2024
1 parent 71a234d commit 2d983ce
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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']);
}

Expand Down

0 comments on commit 2d983ce

Please sign in to comment.