Zend\Code\Generator\ClassGenerator::removeMethod PHP Method

removeMethod() public method

public removeMethod ( string $methodName ) : self
$methodName string
return self
    public function removeMethod($methodName)
    {
        unset($this->methods[strtolower($methodName)]);
        return $this;
    }

Usage Example

 /**
  * @param ContextInterface $context
  * @param ClassGenerator   $class
  * @param Property         $property
  *
  * @throws \Zend\Code\Generator\Exception\InvalidArgumentException
  */
 private function implementGetResult(ContextInterface $context, ClassGenerator $class, Property $property)
 {
     $useAssembler = new UseAssembler($this->wrapperClass ?: ResultInterface::class);
     if ($useAssembler->canAssemble($context)) {
         $useAssembler->assemble($context);
     }
     $methodName = 'getResult';
     $class->removeMethod($methodName);
     $class->addMethodFromGenerator(MethodGenerator::fromArray(['name' => $methodName, 'parameters' => [], 'visibility' => MethodGenerator::VISIBILITY_PUBLIC, 'body' => $this->generateGetResultBody($property), 'docblock' => DocBlockGenerator::fromArray(['tags' => [['name' => 'return', 'description' => $this->generateGetResultReturnTag($property)]]])]));
 }
All Usage Examples Of Zend\Code\Generator\ClassGenerator::removeMethod