@@ -27,14 +27,15 @@ public function read($filePath, $autoloaderPath, $basePath)
2727 {
2828 /** @var ClassLoader $classLoader */
2929 $ classLoader = require $ autoloaderPath ;
30- $ classLoader ->register ();
30+ $ classLoader ->register (true );
3131 $ classes = AnnotationsParser::parsePhp (file_get_contents ($ filePath ));
3232 $ reflector = new ClassReflector (new ComposerSourceLocator ($ classLoader ));
3333 $ output = [];
3434
3535 foreach ($ classes as $ className => $ someData ) {
3636 $ reflectionClass = $ reflector ->reflect ($ className );
37- $ classDocBlock = new DocBlock ($ reflectionClass ->getAst ()->getDocComment ()->getText ());
37+ $ docCommentObject = $ reflectionClass ->getAst ()->getDocComment ();
38+ $ classDocBlock = new DocBlock ($ docCommentObject ? $ docCommentObject ->getText () : '' );
3839 $ classDeprecated = $ classDocBlock ->getTagsByName ('deprecated ' );
3940 $ classSee = $ classDocBlock ->getTagsByName ('see ' );
4041 $ classSince = $ classDocBlock ->getTagsByName ('since ' );
@@ -100,12 +101,13 @@ private function readMethods(ReflectionClass $reflectionClass)
100101 foreach ($ reflectionClass ->getImmediateMethods () as $ method ) {
101102 $ deprecated = $ see = $ since =[];
102103 try {
103- $ docBlock = new DocBlock ($ method ->getAst ()->getDocComment ()->getText ());
104+ $ docCommentObject = $ method ->getAst ()->getDocComment ();
105+ $ docBlock = new DocBlock ($ docCommentObject ? $ docCommentObject ->getText () : '' );
104106 $ deprecated = $ docBlock ->getTagsByName ('deprecated ' );
105107 $ see = $ docBlock ->getTagsByName ('see ' );
106108 $ since = $ docBlock ->getTagsByName ('since ' );
107109 } catch (\Exception $ exception ) {
108- echo 'Invalid DocBlock in ' . $ reflectionClass ->getName () . ':: ' . $ method ->getName () . ' ' . $ reflectionClass ->getLocatedSource ()->getFileName () . PHP_EOL ;
110+ echo 'Invalid DocBlock in ' . $ reflectionClass ->getName () . ':: ' . $ method ->getName () . ' ' . realpath ( $ reflectionClass ->getLocatedSource ()->getFileName ()) . ' :: ' . $ exception -> getMessage () . PHP_EOL ;
109111 }
110112
111113 $ methodMeta = new MethodMetadata ();
@@ -140,7 +142,7 @@ private function readProperties(ReflectionClass $reflectionClass)
140142 $ see = $ docBlock ->getTagsByName ('see ' );
141143 $ since = $ docBlock ->getTagsByName ('since ' );
142144 } catch (\Exception $ exception ) {
143- echo 'Invalid DocBlock in ' . $ reflectionClass ->getName () . ':: ' . $ property ->getName () . ' ' . $ reflectionClass ->getLocatedSource ()->getFileName () . PHP_EOL ;
145+ echo 'Invalid DocBlock in ' . $ reflectionClass ->getName () . ':: ' . $ property ->getName () . ' ' . realpath ( $ reflectionClass ->getLocatedSource ()->getFileName ()) . ' :: ' . $ exception -> getMessage () . PHP_EOL ;
144146 }
145147
146148 $ propertyMetadata = new PropertyMetadata ();
0 commit comments