|
4 | 4 |
|
5 | 5 | namespace Tobion\OpenApiSymfonyRouting; |
6 | 6 |
|
| 7 | +use OpenApi\Analysers\AttributeAnnotationFactory; |
| 8 | +use OpenApi\Analysers\DocBlockAnnotationFactory; |
| 9 | +use OpenApi\Analysers\ReflectionAnalyser; |
7 | 10 | use OpenApi\Analysis; |
8 | 11 | use OpenApi\Annotations\OpenApi; |
9 | 12 | use OpenApi\Annotations\Operation; |
@@ -86,12 +89,23 @@ private function createOpenApi(): OpenApi |
86 | 89 | return \OpenApi\scan($this->finder); |
87 | 90 | } |
88 | 91 |
|
89 | | - $processors = array_filter(Analysis::processors(), static function ($processor): bool { |
90 | | - // remove OperationId processor which would hash the controller starting in 3.2.2 breaking the default route name logic |
91 | | - return !$processor instanceof OperationId && !$processor instanceof DocBlockDescriptions; |
92 | | - }); |
| 92 | + if (method_exists(Analysis::class, 'processors')) { |
| 93 | + $processors = array_filter(Analysis::processors(), static function ($processor): bool { |
| 94 | + // remove OperationId processor which would hash the controller starting in 3.2.2 breaking the default route name logic |
| 95 | + return !$processor instanceof OperationId && !$processor instanceof DocBlockDescriptions; |
| 96 | + }); |
93 | 97 |
|
94 | | - return (new Generator())->setProcessors($processors)->generate($this->finder); |
| 98 | + return (new Generator())->setProcessors($processors)->generate($this->finder); |
| 99 | + } |
| 100 | + |
| 101 | + $analyser = new ReflectionAnalyser([ |
| 102 | + new AttributeAnnotationFactory(), |
| 103 | + new DocBlockAnnotationFactory()] |
| 104 | + ); |
| 105 | + |
| 106 | + return (new Generator()) |
| 107 | + ->setAnalyser($analyser) |
| 108 | + ->generate($this->finder); |
95 | 109 | } |
96 | 110 |
|
97 | 111 | /** |
|
0 commit comments