Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Rector\CodeQuality\Rector\Property;

use PhpParser\Comment\Doc;
use PhpParser\Node;
use PhpParser\Node\Identifier;
use PhpParser\Node\Stmt\Expression;
Expand Down Expand Up @@ -64,6 +65,11 @@ public function getNodeTypes(): array
*/
public function refactor(Node $node): ?Node
{
// a @var tag can only live in a docblock; skip nodes without one
if (!$node->getDocComment() instanceof Doc) {
return null;
}

$phpDocInfo = $this->phpDocInfoFactory->createFromNode($node);
if (! $phpDocInfo instanceof PhpDocInfo) {
return null;
Expand Down
Loading