public static decideTypeFromReflection ( ReflectionType $reflectionType = null, PHPStan\Type\Type $phpDocType = null, string $selfClass = null, boolean $isVariadic = false ) : PHPStan\Type\Type | ||
$reflectionType | ReflectionType | |
$phpDocType | PHPStan\Type\Type | |
$selfClass | string | |
$isVariadic | boolean | |
Résultat | PHPStan\Type\Type |
public function getType() : Type { if ($this->type === null) { $phpDocType = $this->phpDocType; if ($phpDocType !== null && $this->reflection->isDefaultValueAvailable() && $this->reflection->getDefaultValue() === null) { $phpDocType = $phpDocType->makeNullable(); } $this->type = TypehintHelper::decideTypeFromReflection($this->reflection->getType(), $phpDocType, $this->reflection->getDeclaringClass() !== null ? $this->reflection->getDeclaringClass()->getName() : null, $this->reflection->isVariadic()); } return $this->type; }
public function getReturnType() : Type { if ($this->returnType === null) { $returnType = $this->reflection->getReturnType(); $phpDocReturnType = $this->phpDocReturnType; if ($returnType !== null && $phpDocReturnType !== null && $returnType->allowsNull() !== $phpDocReturnType->isNullable()) { $phpDocReturnType = null; } $this->returnType = TypehintHelper::decideTypeFromReflection($returnType, $phpDocReturnType, $this->declaringClass->getName()); } return $this->returnType; }