private static function getReflectedMethodAsSpyClassCode(ReflectionMethod $method)
    {
        $methodName = $method->getName();
        if ($methodName === '__construct') {
            // spy class already has a constructor defined...ignore the constructor of the class we want to spy on
            return "// can't override constructor in generated spy class";
        }

        if ($methodName === '__call') {
            return "// __call magic method not carried over from base class to generated spy class";
        }

        // can't override final methods
        if ($method->isFinal()) {
            return "// can't override final methods in generated spy class";
        }

        $methodSignatureParameters = [];
        $methodParameterNames = [];
        foreach ($method->getParameters() as $parameter) {
            $methodParamType = '';
            if ($parameter->isArray()) {
                $methodParamType = 'array';
            } else {
                $methodParamType = self::resolveParameterType($parameter);
            }
            $methodParamName = "\${$parameter->getName()}";
            $methodParamDefaultValueString = $parameter->isDefaultValueAvailable()
                ? '= '.self::getMethodSignatureDefaultArgumentInProperFormat($parameter->getDefaultValue())
                : '';

            $methodSignatureParameters[] = trim("{$methodParamType} {$methodParamName} {$methodParamDefaultValueString}");
            $methodParameterNames[] = $methodParamName;
        }

        $methodSignatureParametersString = implode(', ', $methodSignatureParameters);
        $methodParameterNamesString = implode(', ', $methodParameterNames);
        $methodType = ($method->isStatic() ? 'static function' : 'function');

        return "    public {$methodType} {$methodName}({$methodSignatureParametersString}) { return \$this->__call('{$methodName}', func_get_args()); }";
    }