rector/packages/BetterPhpDocParser/PhpDocNodeVisitor/ChangedPhpDocNodeVisitor.php
Tomas Votruba 9200bbb091 Updated Rector to commit 9d74e20acb
9d74e20acb [Dep] Add PHPUnit\Framework\TestCase stub on target-repository bootstrap.php (#1924)
2022-03-12 17:33:54 +00:00

32 lines
1.0 KiB
PHP

<?php
declare (strict_types=1);
namespace Rector\BetterPhpDocParser\PhpDocNodeVisitor;
use PHPStan\PhpDocParser\Ast\Node;
use Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey;
use RectorPrefix20220312\Symplify\Astral\PhpDocParser\PhpDocNodeVisitor\AbstractPhpDocNodeVisitor;
final class ChangedPhpDocNodeVisitor extends \RectorPrefix20220312\Symplify\Astral\PhpDocParser\PhpDocNodeVisitor\AbstractPhpDocNodeVisitor
{
/**
* @var bool
*/
private $hasChanged = \false;
public function beforeTraverse(\PHPStan\PhpDocParser\Ast\Node $node) : void
{
$this->hasChanged = \false;
}
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node) : ?\PHPStan\PhpDocParser\Ast\Node
{
$origNode = $node->getAttribute(\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey::ORIG_NODE);
if ($origNode === null) {
$this->hasChanged = \true;
}
return null;
}
public function hasChanged() : bool
{
return $this->hasChanged;
}
}