/** * Get the class from the method that this parameter belongs to, if it * exists. * * This will return null if the declaring function is not a method. * * @return ReflectionClass|null */ public function getDeclaringClass() { if ($this->function instanceof ReflectionMethod) { return $this->function->getDeclaringClass(); } return null; }
/** * Get the type hint declared for the parameter. This is the real type hint * for the parameter, e.g. `method(closure $someFunc)` defined by the * method itself, and is separate from the docblock type hints. * * @see getDocBlockTypes() * @return Type */ public function getTypeHint() { $namespaceForType = $this->function instanceof ReflectionMethod ? $this->function->getDeclaringClass()->getNamespaceName() : $this->function->getNamespaceName(); return (new FindTypeFromAst())->__invoke($this->node->type, $this->function->getLocatedSource(), $namespaceForType); }