PHPStan\Type\ObjectType::combineWith PHP Method

combineWith() public method

public combineWith ( PHPStan\Type\Type $otherType ) : PHPStan\Type\Type
$otherType PHPStan\Type\Type
return PHPStan\Type\Type
    public function combineWith(Type $otherType) : Type
    {
        if ($otherType instanceof self && $this->getClass() == $otherType->getClass()) {
            return new self($this->getClass(), $this->isNullable() || $otherType->isNullable());
        }
        if ($otherType instanceof NullType) {
            return $this->makeNullable();
        }
        return new MixedType($this->isNullable() || $otherType->isNullable());
    }