@@ -64,10 +64,7 @@ public function readObjectFromPhpNode($node, $dummy = null): self
6464
6565 $ docComment = $ node ->getDocComment ();
6666 if ($ docComment ) {
67- $ propertiesPhp = $ this ->readPhpDocProperties ($ docComment ->getText ());
68- foreach ($ propertiesPhp as $ propertyPhp ) {
69- $ this ->properties [$ propertyPhp ->name ] = $ propertyPhp ;
70- }
67+ $ this ->readPhpDocProperties ($ docComment ->getText ());
7168 }
7269
7370 foreach ($ node ->getProperties () as $ property ) {
@@ -284,13 +281,13 @@ public function getMethodsInfo(
284281 /**
285282 * @param string $docComment
286283 *
287- * @return PHPProperty[]
284+ * @return void
288285 */
289- private function readPhpDocProperties (string $ docComment ): array
286+ private function readPhpDocProperties (string $ docComment ): void
290287 {
291- // init
292- /** @var PHPProperty[] $classPhpDocProperties */
293- $ classPhpDocProperties = [];
288+ if ( $ docComment === '' ) {
289+ return ;
290+ }
294291
295292 try {
296293 $ phpDoc = Utils::createDocBlockInstance ()->create ($ docComment );
@@ -345,15 +342,13 @@ private function readPhpDocProperties(string $docComment): array
345342 $ propertyPhp ->typeFromPhpDocPslam = (string ) @\Psalm \Type::parseString ($ propertyPhp ->typeFromPhpDoc );
346343 }
347344
348- $ classPhpDocProperties [$ propertyPhp ->name ] = $ propertyPhp ;
345+ $ this -> properties [$ propertyPhp ->name ] = $ propertyPhp ;
349346 }
350347 }
351348 }
352349 } catch (\Exception $ e ) {
353350 $ tmpErrorMessage = $ this ->name . ': ' . ($ this ->line ?? '' ) . ' | ' . \print_r ($ e ->getMessage (), true );
354351 $ this ->parseError [\md5 ($ tmpErrorMessage )] = $ tmpErrorMessage ;
355352 }
356-
357- return $ classPhpDocProperties ;
358353 }
359354}
0 commit comments