mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-24 11:44:14 +01:00
fix get class on trait
This commit is contained in:
parent
d3bf2c0364
commit
935b08e4ad
@ -12,6 +12,7 @@ use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Expr\Ternary;
|
||||
use PhpParser\Node\Identifier;
|
||||
use PhpParser\Node\Name;
|
||||
use PhpParser\Node\Stmt\Trait_;
|
||||
use PHPStan\Analyser\Scope;
|
||||
use PHPStan\Type\NullType;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
@ -107,6 +108,11 @@ PHP
|
||||
|
||||
private function shouldSkip(FuncCall $funcCall): bool
|
||||
{
|
||||
$class = $funcCall->getAttribute(AttributeKey::CLASS_NODE);
|
||||
if ($class instanceof Trait_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$parentNode = $funcCall->getAttribute(AttributeKey::PARENT_NODE);
|
||||
if (! $parentNode instanceof Ternary) {
|
||||
return false;
|
||||
@ -115,7 +121,12 @@ PHP
|
||||
if ($this->isIdenticalToNotNull($funcCall, $parentNode)) {
|
||||
return true;
|
||||
}
|
||||
return $this->isNotIdenticalToNull($funcCall, $parentNode);
|
||||
|
||||
if ($this->isNotIdenticalToNull($funcCall, $parentNode)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user