mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-22 02:36:52 +01:00
32 lines
1.0 KiB
PHP
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 RectorPrefix20210617\Symplify\SimplePhpDocParser\PhpDocNodeVisitor\AbstractPhpDocNodeVisitor;
|
|
final class ChangedPhpDocNodeVisitor extends \RectorPrefix20210617\Symplify\SimplePhpDocParser\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;
|
|
}
|
|
}
|