Skip to content
This repository was archived by the owner on May 6, 2025. It is now read-only.

Commit 677cf95

Browse files
committed
patch more
1 parent 8682d1e commit 677cf95

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/Visitor/Deprecation/FindDeprecatedTagsVisitor.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function enterNode(Node $node)
5656

5757
if ($node instanceof Node\Stmt\Function_) {
5858
$this->phpFileInfo->addFunctionDeprecation(
59-
new FunctionDeprecation($node->name, $this->getDeprecatedDocComment($node))
59+
new FunctionDeprecation($node->name->toString(), $this->getDeprecatedDocComment($node))
6060
);
6161

6262
return;
@@ -80,7 +80,11 @@ public function enterNode(Node $node)
8080

8181
if ($node instanceof Node\Stmt\ClassMethod) {
8282
$this->phpFileInfo->addMethodDeprecation(
83-
new MethodDeprecation($this->parentName, $node->name, $this->getDeprecatedDocComment($node))
83+
new MethodDeprecation(
84+
$this->parentName,
85+
$node->name->toString(),
86+
$this->getDeprecatedDocComment($node)
87+
)
8488
);
8589

8690
return;
@@ -122,15 +126,15 @@ protected function hasDeprecatedDocComment(Node $node)
122126
protected function getDeprecatedDocComment(Node $node)
123127
{
124128
try {
125-
$docBlock = new DocBlock((string) $node->getDocComment());
126-
/** @var DocBlock\Tag\DeprecatedTag[] $deprecatedTag */
127-
$deprecatedTag = $docBlock->getTagsByName('deprecated');
129+
$factory = DocBlockFactory::createInstance();
130+
$docBlock = $factory->create((string) $node->getDocComment());
131+
$deprecatedTags = $docBlock->getTagsByName('deprecated');
128132

129-
if (0 === count($deprecatedTag)) {
133+
if (0 === count($deprecatedTags)) {
130134
return;
131135
}
132136

133-
$comment = $deprecatedTag[0]->getContent();
137+
$comment = (string) $deprecatedTags[0];
134138

135139
return preg_replace('/[[:blank:]]+/', ' ', $comment);
136140
} catch (\Exception $e) {

0 commit comments

Comments
 (0)