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.
public getTypeHint ( ) : phpDocumentor\Reflection\Type | ||
return | phpDocumentor\Reflection\Type |
/** * @return string */ public function getHints() { $hints = $this->reflectionParameter->getDocBlockTypeStrings(); $hints[] = $this->reflectionParameter->getTypeHint(); $hints = array_filter($hints, 'strlen'); return implode('|', $hints); }
/** * Factory depuis une reflection * * @param ReflectionParameter $reflection * @return static */ public static function fromReflection(ReflectionParameter $reflection) { // VALUE $value = $reflection->isDefaultValueAvailable() ? $reflection->getDefaultValue() : Maker::NO_VALUE; // TYPE $type = $reflection->getTypeHint(); // analyse du type if (!is_null($type)) { if ($type instanceof Object_) { $type = strval($type->getFqsen()); } elseif ($type instanceof Array_) { $type = 'array'; } else { exc('Impossible de determiner le type du paramètre : ' . $reflection->getName()); } } // construction $parameter = new static($reflection->getName(), $value, $type); return $parameter; }