Extract the return type of a method.

@param  object $method A instance of `ReflectionMethod`.
@return string         The return type.
359968
protected static function _generateReturnType($method)
    {
        if (Suite::$PHP < 7) {
            return '';
        }
        $type = $method->getReturnType();
        $allowsNull = '';
        if ($type) {
            if (method_exists($type, 'allowsNull') && $type->allowsNull()) {
                $allowsNull = '?';
            }
            if (!$type->isBuiltin()) {
                $type = '\\' . $type;
            }
            if (defined('HHVM_VERSION')) {
                $type = preg_replace('~\\\?HH\\\(mixed|void)?~', '', $type);
            }
        }
        return $type ? ": {$allowsNull}{$type} " : '';
    }
561785
protected function getMethodCallbacks(\ReflectionMethod $method)
    {
        $callbacks = [];
        $annotations = $this->reader->getMethodAnnotations($method);

        foreach ($annotations as $annotation) {
            if ($annotation instanceof ORM\PrePersist) {
                $callbacks[] = [$method->name, Events::prePersist];
            }

            if ($annotation instanceof ORM\PostPersist) {
                $callbacks[] = [$method->name, Events::postPersist];
            }

            if ($annotation instanceof ORM\PreUpdate) {
                $callbacks[] = [$method->name, Events::preUpdate];
            }

            if ($annotation instanceof ORM\PostUpdate) {
                $callbacks[] = [$method->name, Events::postUpdate];
            }

            if ($annotation instanceof ORM\PreRemove) {
                $callbacks[] = [$method->name, Events::preRemove];
            }

            if ($annotation instanceof ORM\PostRemove) {
                $callbacks[] = [$method->name, Events::postRemove];
            }

            if ($annotation instanceof ORM\PostLoad) {
                $callbacks[] = [$method->name, Events::postLoad];
            }

            if ($annotation instanceof ORM\PreFlush) {
                $callbacks[] = [$method->name, Events::preFlush];
            }
        }

        return $callbacks;
    }
745993
private function getMethodCallbacks(\ReflectionMethod $method)
    {
        $callbacks   = array();
        $annotations = $this->reader->getMethodAnnotations($method);

        foreach ($annotations as $annot) {
            if ($annot instanceof \Doctrine\ORM\Mapping\PrePersist) {
                $callbacks[] = array($method->name, Events::prePersist);
            }

            if ($annot instanceof \Doctrine\ORM\Mapping\PostPersist) {
                $callbacks[] = array($method->name, Events::postPersist);
            }

            if ($annot instanceof \Doctrine\ORM\Mapping\PreUpdate) {
                $callbacks[] = array($method->name, Events::preUpdate);
            }

            if ($annot instanceof \Doctrine\ORM\Mapping\PostUpdate) {
                $callbacks[] = array($method->name, Events::postUpdate);
            }

            if ($annot instanceof \Doctrine\ORM\Mapping\PreRemove) {
                $callbacks[] = array($method->name, Events::preRemove);
            }

            if ($annot instanceof \Doctrine\ORM\Mapping\PostRemove) {
                $callbacks[] = array($method->name, Events::postRemove);
            }

            if ($annot instanceof \Doctrine\ORM\Mapping\PostLoad) {
                $callbacks[] = array($method->name, Events::postLoad);
            }

            if ($annot instanceof \Doctrine\ORM\Mapping\PreFlush) {
                $callbacks[] = array($method->name, Events::preFlush);
            }
        }

        return $callbacks;
    }
1018607
protected function isGetMethod(\ReflectionMethod $method)
    {
        return 'get' === substr($method->name, 0, 3) && strlen($method->name) > 3 &&
            0 === $method->getNumberOfRequiredParameters();
    }
1234500
protected function getClassFromMethod($method)
    {
        // Look for a studly class
        $class = Str::singular(Str::studly($method));

        foreach ($this->repositories as $repository) {
            if (class_exists($repository.$class)) {
                return $repository.$class;
            }
        }

        // Resume normal functioning
        return parent::getClassFromMethod($method);
    }
118837
public function isSupportedMethod($method) {
        if (!is_string($method)) throw new IllegalTypeException('Illegal type of parameter $method: '.gettype($method));
        return isset($this->methods[strtoupper($method)]);
    }
460995
public function inflectionMethod($method = null)
    {
        if ($method !== null) {
            $this->setInflectionMethod($method);
        }

        return $this->getInflectionMethod();
    }
743807
protected function getReflectionMethod($class, $method)
    {
        if (!isset($this->methodReflectors[$class])) {
            $this->methodReflectors[$class] = [];
        }
        if (!isset($this->methodReflectors[$class][$method])) {
            $this->methodReflectors[$class][$method] = new \ReflectionMethod($class, $method);
        }

        return $this->methodReflectors[$class][$method];
    }
57113
protected static function getReturnType(\ReflectionMethod $method) : string
    {
        if ($method->getReturnType()->isBuiltin()) {
            return (string)$method->getReturnType();
        } else {
            $type = (string)$method->getReturnType();
            return '\\' . ($type === 'self' ? $method->getDeclaringClass()->getName() : $type);
        }
    }
1355761
public function getMethod ($method)
	{
		
		// Get methods
		
		$this->getMethods ();
		
		// Loop through the methods
		
		foreach ($this->methods as $obj)
		{
			
			// If the method names match return 
			
			if (strtolower ($obj->get ('name')) == strtolower ($method))
			{
				return $obj;
			}
			
		}
		
		// Return FALSE
		
		return FALSE;
		
	}
679774
protected function resolveNameByMethod(\ReflectionMethod $method): string
    {
        $name = $method->getName();

        if (preg_match('~^(?:get|is)(?<name>[a-z0-9_]+)~i', $name, $matches)) {
            return lcfirst($matches['name']);
        }

        return $name;
    }
76912
private function getFallbackHandler(string $method)
    {
        if (empty($this->fallback)) {
            return null;
        }

        $fallback   = \fallback($this->fallback);
        $interfaces = class_implements(static::class);
        foreach ($interfaces as $interface) {
            if (is_subclass_of($fallback, $interface)) {
                return [$fallback, $method];
            }
        }

        App::warning(sprintf('The %s class does not implement the %s interface', get_parent_class($fallback), JsonHelper::encode($interfaces, JSON_UNESCAPED_UNICODE)));

        return null;
    }
295394
protected function chain($method) {
		// Is destructive
		if(substr($method, -1) == '_') {
			// The non-destructive name
			$method = substr($method, 0, -1);

			// Absolute name
			if(isset(self::$enumData['methodMap'][$method])) {
				$method = self::$enumData['methodMap'][$method];
			}

			// Give back return value
			if(isset(self::$enumData['destructiveMap'][$method])) {
				return self::$enumData['destructiveMap'][$method];
			}
		}

		// Default return
		return false;
	}
53445
private function getMethods($methods)
    {
        $methods = $methods ?? $this->methods;

        if (is_string($methods))
            $methods = (array) $methods;

        return is_array($methods) ? array_map('strtoupper', $methods) : [];
    }
148525
public String getMethodName(Method method) {
        String name;
        if (ClassUtils.isBooleanGetter(method)) {
            name = extractMethodName(method, 2);
        } else {
            name = extractMethodName(method, 3);
        }
        return name;
    }
598351
final public function get($method = null) {

        if ( empty($method) ) {

            $return = $this->rpc_methods;

        } else if ( array_key_exists($method, $this->rpc_methods) ) {

            $return = $this->rpc_methods[$method];

        } else {

            $return = null;

        }

        return $return;

    }
954971
public function getReflectionMethod(string $method)
    {
        if (!isset($this->reflectionMethod[$method])) {
            $this->reflectionMethod[$method] = new ReflectionMethod($this, $method);
        }

        return $this->reflectionMethod[$method];
    }