PHPStan\Type\Type::isNullable PHP Method

isNullable() public method

public isNullable ( ) : boolean
return boolean
    public function isNullable() : bool;

Usage Example

 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;
 }