mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-24 03:35:01 +01:00
misc
This commit is contained in:
parent
2d57726c82
commit
e6b5bc2f25
@ -71,11 +71,9 @@ final class DocBlockAnalyzer
|
|||||||
|
|
||||||
public function getVarTypes(Node $node): ?string
|
public function getVarTypes(Node $node): ?string
|
||||||
{
|
{
|
||||||
$docBlock = $this->docBlockFactory->createFromNode($node);
|
|
||||||
|
|
||||||
/** @var Var_[] $varTags */
|
/** @var Var_[] $varTags */
|
||||||
$varTags = $docBlock->getTagsByName('var');
|
$varTags = $this->getTagsByName($node, 'var');
|
||||||
if (count($varTags) === 0) {
|
if ($varTags === null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,24 +82,21 @@ final class DocBlockAnalyzer
|
|||||||
|
|
||||||
public function getDeprecatedDocComment(Node $node): ?string
|
public function getDeprecatedDocComment(Node $node): ?string
|
||||||
{
|
{
|
||||||
$docBlock = $this->docBlockFactory->createFromNode($node);
|
|
||||||
|
|
||||||
/** @var Deprecated[] $deprecatedTags */
|
/** @var Deprecated[] $deprecatedTags */
|
||||||
$deprecatedTags = $docBlock->getTagsByName('deprecated');
|
$deprecatedTags = $this->getTagsByName($node, 'deprecated');
|
||||||
if (count($deprecatedTags) === 0) {
|
if ($deprecatedTags === null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $deprecatedTags[0]->getDescription()->render();
|
return $deprecatedTags[0]->getDescription()
|
||||||
|
->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getParamTypeFor(Node $node, string $paramName): ?string
|
public function getParamTypeFor(Node $node, string $paramName): ?string
|
||||||
{
|
{
|
||||||
$docBlock = $this->docBlockFactory->createFromNode($node);
|
|
||||||
|
|
||||||
/** @var Param[] $paramTags */
|
/** @var Param[] $paramTags */
|
||||||
$paramTags = $docBlock->getTagsByName('param');
|
$paramTags = $this->getTagsByName($node, 'param');
|
||||||
if (count($paramTags) === 0) {
|
if ($paramTags === 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,4 +146,16 @@ final class DocBlockAnalyzer
|
|||||||
{
|
{
|
||||||
return (bool) preg_match('#^/\*\*[\s\*]*\*/$#', $docContent);
|
return (bool) preg_match('#^/\*\*[\s\*]*\*/$#', $docContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getTagsByName(Node $node, string $name): ?array
|
||||||
|
{
|
||||||
|
$docBlock = $this->docBlockFactory->createFromNode($node);
|
||||||
|
|
||||||
|
$tags = $docBlock->getTagsByName($name);
|
||||||
|
if (count($tags) === 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $tags;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user