1
0
mirror of https://github.com/danog/phpdoc.git synced 2024-11-26 12:04:47 +01:00
This commit is contained in:
Daniil Gentili 2023-07-14 16:38:29 +02:00
parent 12d8733995
commit 1ac05c37d8
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
3 changed files with 6 additions and 25 deletions

View File

@ -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);

View File

@ -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);
}
/**

View File

@ -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])) {