mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-23 19:24:48 +01:00
MagicMethodRector - simplify class type analysis
This commit is contained in:
parent
bb7225c625
commit
693a715e3b
@ -18,11 +18,6 @@ use Rector\Regex\MagicMethodMatcher;
|
|||||||
*/
|
*/
|
||||||
final class MagicMethodRector extends AbstractRector
|
final class MagicMethodRector extends AbstractRector
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private const NETTE_OBJECT_CLASS = 'Nette\Object';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var mixed[]
|
* @var mixed[]
|
||||||
*/
|
*/
|
||||||
@ -121,12 +116,6 @@ final class MagicMethodRector extends AbstractRector
|
|||||||
|
|
||||||
private function isNetteObjectChild(Class_ $classNode): bool
|
private function isNetteObjectChild(Class_ $classNode): bool
|
||||||
{
|
{
|
||||||
if ($classNode->extends === null) {
|
return in_array('Nette\Object', (array) $classNode->getAttribute(Attribute::TYPES), true);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$parentClassName = (string) $classNode->extends->getAttribute(Attribute::RESOLVED_NAME);
|
|
||||||
|
|
||||||
return $parentClassName === self::NETTE_OBJECT_CLASS;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user