mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-26 04:42:36 +00:00
28 lines
683 B
PHP
28 lines
683 B
PHP
<?php
|
|
|
|
declare (strict_types=1);
|
|
namespace Rector\NodeAnalyzer;
|
|
|
|
use PhpParser\Node;
|
|
use PhpParser\Node\Arg;
|
|
use PhpParser\Node\Expr\Variable;
|
|
use PhpParser\Node\Identifier;
|
|
use PhpParser\Node\Name;
|
|
use PhpParser\Node\Param;
|
|
final class ScopeAnalyzer
|
|
{
|
|
/**
|
|
* @var array<class-string<Node>>
|
|
*/
|
|
private const NON_REFRESHABLE_NODES = [Name::class, Identifier::class, Param::class, Arg::class, Variable::class];
|
|
public function isRefreshable(Node $node) : bool
|
|
{
|
|
foreach (self::NON_REFRESHABLE_NODES as $noScopeNode) {
|
|
if ($node instanceof $noScopeNode) {
|
|
return \false;
|
|
}
|
|
}
|
|
return \true;
|
|
}
|
|
}
|