/** * @return null */ public function addMethod(CodeBase $code_base, Method $method) { $method_fqsen = FullyQualifiedMethodName::make($this->getFQSEN(), $method->getName()); // Don't overwrite overridden methods with // parent methods if ($code_base->hasMethodWithFQSEN($method_fqsen)) { // Note that we're overriding something $existing_method = $code_base->getMethodByFQSEN($method_fqsen); $existing_method->setIsOverride(true); // Don't add the method return; } if ($method->getFQSEN() !== $method_fqsen) { $method = clone $method; $method->setFQSEN($method_fqsen); } $code_base->addMethod($method); }