mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-23 11:14:38 +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
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const NETTE_OBJECT_CLASS = 'Nette\Object';
|
||||
|
||||
/**
|
||||
* @var mixed[]
|
||||
*/
|
||||
@ -121,12 +116,6 @@ final class MagicMethodRector extends AbstractRector
|
||||
|
||||
private function isNetteObjectChild(Class_ $classNode): bool
|
||||
{
|
||||
if ($classNode->extends === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$parentClassName = (string) $classNode->extends->getAttribute(Attribute::RESOLVED_NAME);
|
||||
|
||||
return $parentClassName === self::NETTE_OBJECT_CLASS;
|
||||
return in_array('Nette\Object', (array) $classNode->getAttribute(Attribute::TYPES), true);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user