mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-25 20:32:35 +00:00
Use Class_::getProperty()
(#5555)
* Use `Class_::getProperty()` * Update src/NodeManipulator/ClassInsertManipulator.php Co-authored-by: Abdul Malik Ikhsan <samsonasik@gmail.com> Co-authored-by: Tomas Votruba <tomas.vot@gmail.com> Co-authored-by: Abdul Malik Ikhsan <samsonasik@gmail.com>
This commit is contained in:
parent
c0240e8bfd
commit
19c876f01e
|
@ -154,20 +154,9 @@ final class ClassInsertManipulator
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits on https://github.com/nikic/PHP-Parser/pull/646
|
||||
*/
|
||||
private function hasClassProperty(Class_ $class, string $name): bool
|
||||
{
|
||||
foreach ($class->getProperties() as $property) {
|
||||
if (! $this->nodeNameResolver->isName($property, $name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return $class->getProperty($name) instanceof Property;
|
||||
}
|
||||
|
||||
private function addTraitUse(Class_ $class, TraitUse $traitUse): void
|
||||
|
|
Loading…
Reference in New Issue
Block a user