getTypeHint() публичный Метод

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.
См. также: getDocBlockTypes()
public getTypeHint ( ) : phpDocumentor\Reflection\Type
Результат phpDocumentor\Reflection\Type
Пример #1
0
 /**
  * @return string
  */
 public function getHints()
 {
     $hints = $this->reflectionParameter->getDocBlockTypeStrings();
     $hints[] = $this->reflectionParameter->getTypeHint();
     $hints = array_filter($hints, 'strlen');
     return implode('|', $hints);
 }
Пример #2
0
 /**
  * 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;
 }