public function removeMethod($nameOrMethod)
{
if ($nameOrMethod instanceof PhpMethod) {
$nameOrMethod = $nameOrMethod->getName();
}
if (!$this->methods->has($nameOrMethod)) {
throw new \InvalidArgumentException(sprintf('The method "%s" does not exist.', $nameOrMethod));
}
$m = $this->methods->get($nameOrMethod);
$m->setParent(null);
$this->methods->remove($nameOrMethod);
return $this;
}