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;
}