decideType() public static method

public static decideType ( 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
return PHPStan\Type\Type
コード例 #1
0
 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::decideType($this->reflection->getType(), $phpDocType, $this->reflection->getDeclaringClass() !== null ? $this->reflection->getDeclaringClass()->getName() : null, $this->reflection->isVariadic());
     }
     return $this->type;
 }
コード例 #2
0
 public function getReturnType() : Type
 {
     if ($this->returnType === null) {
         $phpDocReturnType = $this->phpDocReturnType;
         if ($this->realReturnTypePresent && $phpDocReturnType !== null && $this->realReturnType->isNullable() !== $phpDocReturnType->isNullable()) {
             $phpDocReturnType = null;
         }
         $this->returnType = TypehintHelper::decideType($this->realReturnType, $phpDocReturnType);
     }
     return $this->returnType;
 }
コード例 #3
0
 public function getReturnType() : Type
 {
     if ($this->returnType === null) {
         $this->returnType = TypehintHelper::decideType($this->reflection->getReturnType(), $this->phpDocReturnType, $this->declaringClass->getName());
     }
     return $this->returnType;
 }