/** * Inherits all methods from the given parent class. * * @param ClassNode $parent parent object to inherit methods from. * * @return void */ protected function inheritMethods(ClassNode $parent) { /** @var MethodNode[] $methods */ $methods = $this->getMethods(); /** @var MethodNode $parent_method */ foreach ($parent->getMethods() as $key => $parent_method) { if (isset($methods[$key])) { $methods[$key]->inherit($parent_method); } else { $parent_method->copyTo($this); } } }