bitExpert\Disco\Proxy\Configuration\MethodGenerator\BeanMethod::fromReflection PHP Method

fromReflection() public static method

public static fromReflection ( Zend\Code\Reflection\MethodReflection $reflectionMethod ) : ProxyManager\Generator\MethodGenerator
$reflectionMethod Zend\Code\Reflection\MethodReflection
return ProxyManager\Generator\MethodGenerator
    public static function fromReflection(MethodReflection $reflectionMethod) : MethodGenerator
    {
        $method = parent::fromReflection($reflectionMethod);
        /*
         * When overwriting methods PHP 7 enforces the same method parameters to be defined as in the base class. Since
         * the {@link \bitExpert\Disco\AnnotationBeanFactory} calls the generated methods without any parameters we
         * simply set a default value of null for each of the method parameters.
         */
        $method->setParameters([]);
        foreach ($reflectionMethod->getParameters() as $reflectionParameter) {
            $parameter = ParameterGenerator::fromReflection($reflectionParameter);
            $parameter->setDefaultValue(null);
            $method->setParameter($parameter);
        }
        return $method;
    }