* @license MIT */ class NullObjectMethodInterceptor extends MethodGenerator { /** * @param \Zend\Code\Reflection\MethodReflection $originalMethod * * @return self|static */ public static function generateMethod(MethodReflection $originalMethod) : self { /* @var $method self */ $method = static::fromReflectionWithoutBodyAndDocBlock($originalMethod); if ($originalMethod->returnsReference()) { $reference = IdentifierSuffixer::getIdentifier('ref'); $method->setBody("\$$reference = null;\nreturn \$$reference;"); } return $method; } }