*/ public static function scan ( iterable $sources, array $options = ) : OpenApi * logger: null|\Psr\Log\LoggerInterface If not set logging will use \OpenApi\Logger as before. * processors: null|array Defaults to `Analysis::processors()`. * analysis: null|Analysis Defaults to a new `Analysis`. * analyser: null|AnalyserInterface Defaults to a new `ReflectionAnalyser` supporting both docblocks and attributes. * iterable $sources PHP source files to scan. * Static wrapper around `Generator::generate()`. The minimum code required, using the generate() method, looks quite similar to the old scan() code: Support for Symfony Finder, \SplInfo and file/directory names (`string) as source.Static configuration is deprecated and can be removed at some point without code changes.The get/set methods allow for using type hints.Static settings will be reverted to the default once finished.The Generator code will handle configuring things as before in a single place.Under the hood this is handled by registering a custom loader with the doctrine annotation library. Namespaces control which annotation namespaces can be autoloaded automatically. Effectively they avoid having to write use OpenApi\Annotations as OA in your code and make annotations still work. Require ( "vendor/autoload.php" ) $validate = true $logger = new \Psr \Log \NullLogger ( ) $processors = $finder = \Symfony \Component \Finder \Finder :: create ( ) -> files ( ) -> name ( '*.php' ) -> in ( _DIR_ ) $openapi = ( new \OpenApi \Generator ( $logger ) ) -> setProcessors ( $processors ) -> setAliases ( ) -> setNamespaces ( ) -> setAnalyser ( new \OpenApi \Analysers \TokenAnalyser ( ) ) -> setVersion ( \OpenApi \Annotations \OpenApi :: VERSION_3_0_0 ) -> generate (, new \OpenApi \Analysis ( ), $validate ) Īliases and namespaces are additional options that allow to customize the parsing of docblocks.Īliases: Īliases help the underlying doctrine annotations library to parse annotations.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |