diff --git a/src/PhpDoc/ClassDoc.php b/src/PhpDoc/ClassDoc.php index 9b14ca9..5db1f96 100644 --- a/src/PhpDoc/ClassDoc.php +++ b/src/PhpDoc/ClassDoc.php @@ -39,12 +39,7 @@ class ClassDoc extends GenericDoc { $this->builder = $builder; $this->name = $reflectionClass->getName(); - $doc = $reflectionClass->getDocComment(); - if (!$doc) { - \fprintf(STDERR, $reflectionClass->getName()." has no PHPDOC".PHP_EOL); - $this->ignore = true; - return; - } + $doc = $reflectionClass->getDocComment() ?: '/** */'; $doc = $this->builder->getFactory()->create($doc); parent::__construct($doc, $reflectionClass); diff --git a/src/PhpDoc/FunctionDoc.php b/src/PhpDoc/FunctionDoc.php index 4e347b8..508c246 100644 --- a/src/PhpDoc/FunctionDoc.php +++ b/src/PhpDoc/FunctionDoc.php @@ -22,14 +22,6 @@ class FunctionDoc extends MethodDoc { $this->builder = $builder; $this->name = $reflectionClass->getName(); - $doc = $reflectionClass->getDocComment(); - if (!$doc) { - \fprintf(STDERR, $reflectionClass->getName()." has no PHPDOC".PHP_EOL); - $this->ignore = true; - return; - } - $doc = $this->builder->getFactory()->create($doc); - parent::__construct($builder, $reflectionClass); } /** diff --git a/src/PhpDoc/MethodDoc.php b/src/PhpDoc/MethodDoc.php index fa62e75..922a768 100644 --- a/src/PhpDoc/MethodDoc.php +++ b/src/PhpDoc/MethodDoc.php @@ -31,16 +31,7 @@ class MethodDoc extends GenericDoc { $this->builder = $phpDocBuilder; $this->name = $method->getName(); - $doc = $method->getDocComment(); - if (!$doc) { - $this->ignore = true; - if ($method instanceof ReflectionMethod) { - \fprintf(STDERR, $method->getDeclaringClass()->getName().'::'.$method->getName().' has no PHPDOC!'.PHP_EOL); - } else { - \fprintf(STDERR, $method->getName()." has no PHPDOC!".PHP_EOL); - } - return; - } + $doc = $method->getDocComment() ?: '/** */'; $doc = $this->builder->getFactory()->create($doc); parent::__construct($doc, $method instanceof ReflectionMethod ? $method->getDeclaringClass() : $method); @@ -84,7 +75,10 @@ class MethodDoc extends GenericDoc } elseif ($tag instanceof Generic && $tag->getName() === 'psalm-return') { $this->psalmReturn = $tag; } elseif ($tag instanceof Generic && $tag->getName() === 'psalm-param') { - [$type, $description] = \explode(" $", $tag->getDescription(), 2); + $desc = $tag->getDescription(); + $dollar = \strrpos($desc, '$'); + $type = \substr($tag, 0, $dollar-1); + $description = \substr($tag, $dollar+1); $description .= ' '; [$varName, $description] = \explode(" ", $description, 2); if (!$description && isset($params[$varName])) {