Skip to content

Commit

Permalink
isSuperTypeOf() returns IsSuperTypeOfResult
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Nov 14, 2024
1 parent 91239bd commit e28fb5e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/DoctrineReflection/DoctrineResultObjectType.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Doctrine\DBAL\Result;
use PHPStan\ShouldNotHappenException;
use PHPStan\TrinaryLogic;
use PHPStan\Type\IsSuperTypeOfResult;
use PHPStan\Type\ObjectType;
use PHPStan\Type\Type;

Expand Down Expand Up @@ -51,10 +52,10 @@ public function equals(Type $type): bool
return parent::equals($type);
}

public function isSuperTypeOf(Type $type): TrinaryLogic
public function isSuperTypeOf(Type $type): IsSuperTypeOfResult
{
if ($type instanceof self) {
return TrinaryLogic::createFromBoolean(
return IsSuperTypeOfResult::createFromBoolean(
$type->rowType !== null
&& $this->rowType !== null
&& $type->rowType->equals($this->rowType)
Expand Down
5 changes: 3 additions & 2 deletions src/DoctrineReflection/DoctrineStatementObjectType.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Doctrine\DBAL\Statement;
use PHPStan\ShouldNotHappenException;
use PHPStan\TrinaryLogic;
use PHPStan\Type\IsSuperTypeOfResult;
use PHPStan\Type\ObjectType;
use PHPStan\Type\Type;

Expand Down Expand Up @@ -51,10 +52,10 @@ public function equals(Type $type): bool
return parent::equals($type);
}

public function isSuperTypeOf(Type $type): TrinaryLogic
public function isSuperTypeOf(Type $type): IsSuperTypeOfResult
{
if ($type instanceof self) {
return TrinaryLogic::createFromBoolean(
return IsSuperTypeOfResult::createFromBoolean(
$type->rowType !== null
&& $this->rowType !== null
&& $type->rowType->equals($this->rowType)
Expand Down
2 changes: 1 addition & 1 deletion src/QueryReflection/QueryReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public function isResolvable(Expr $queryExpr, Scope $scope): TrinaryLogic
}
$isStringOrMixed = $type->isSuperTypeOf(new StringType());

return $isStringOrMixed->negate();
return $isStringOrMixed->negate()->result;
}

/**
Expand Down

0 comments on commit e28fb5e

Please sign in to comment.