66
77namespace OpenApi \Console ;
88
9- use OpenApi \Analysers \AttributeAnnotationFactory ;
10- use OpenApi \Analysers \DocBlockAnnotationFactory ;
11- use OpenApi \Analysers \ReflectionAnalyser ;
12- use OpenApi \Annotations \OpenApi ;
9+ use OpenApi \Annotations as OA ;
1310use OpenApi \Generator ;
1411use OpenApi \SourceFinder ;
1512use Symfony \Component \Console \Attribute \AsCommand ;
@@ -68,7 +65,7 @@ public function __invoke(#[MapInput] GenerateInput $input, SymfonyStyle $io): in
6865 return $ this ->logger ->hasErrored () ? 1 : 0 ;
6966 }
7067
71- private function generate (GenerateInput $ input ): OpenApi
68+ private function generate (GenerateInput $ input ): OA \ OpenApi
7269 {
7370 $ generator = new Generator ($ this ->logger );
7471
@@ -89,37 +86,9 @@ private function generate(GenerateInput $input): OpenApi
8986 $ generator ->getProcessorPipeline ()->remove ($ class );
9087 }
9188
92- $ analyser = new ReflectionAnalyser ([
93- new AttributeAnnotationFactory (),
94- new DocBlockAnnotationFactory (),
95- ]);
96- $ analyser ->setGenerator ($ generator );
97-
9889 return $ generator
9990 ->setVersion ($ input ->version )
10091 ->setConfig ($ input ->config )
101- ->setAnalyser ($ analyser )
102- ->generate (new SourceFinder ($ input ->paths , $ this ->normalizeExcludePaths ($ input ->exclude ), $ input ->pattern ));
103- }
104-
105- /**
106- * @param list<string> $exclude
107- *
108- * @return list<string>
109- */
110- private function normalizeExcludePaths (array $ exclude ): array
111- {
112- if (!$ exclude ) {
113- return [];
114- }
115-
116- if (str_contains ($ exclude [0 ], ', ' )) {
117- $ exploded = explode (', ' , $ exclude [0 ]);
118- $ this ->logger ->error ('Comma-separated exclude paths are deprecated, use multiple --exclude statements: --exclude ' . $ exploded [0 ] . ' --exclude ' . $ exploded [1 ]);
119- $ exclude [0 ] = array_shift ($ exploded );
120- $ exclude = array_merge ($ exclude , $ exploded );
121- }
122-
123- return $ exclude ;
92+ ->generate (new SourceFinder ($ input ->paths , $ input ->exclude , $ input ->pattern ));
12493 }
12594}
0 commit comments