Skip to content

Commit 7c2e0e4

Browse files
committed
isSuperTypeOf() returns IsSuperTypeOfResult
1 parent 91239bd commit 7c2e0e4

File tree

5 files changed

+13
-9
lines changed

5 files changed

+13
-9
lines changed

src/DoctrineReflection/DoctrineResultObjectType.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Doctrine\DBAL\Result;
88
use PHPStan\ShouldNotHappenException;
99
use PHPStan\TrinaryLogic;
10+
use PHPStan\Type\IsSuperTypeOfResult;
1011
use PHPStan\Type\ObjectType;
1112
use PHPStan\Type\Type;
1213

@@ -51,10 +52,10 @@ public function equals(Type $type): bool
5152
return parent::equals($type);
5253
}
5354

54-
public function isSuperTypeOf(Type $type): TrinaryLogic
55+
public function isSuperTypeOf(Type $type): IsSuperTypeOfResult
5556
{
5657
if ($type instanceof self) {
57-
return TrinaryLogic::createFromBoolean(
58+
return IsSuperTypeOfResult::createFromBoolean(
5859
$type->rowType !== null
5960
&& $this->rowType !== null
6061
&& $type->rowType->equals($this->rowType)

src/DoctrineReflection/DoctrineStatementObjectType.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Doctrine\DBAL\Statement;
88
use PHPStan\ShouldNotHappenException;
99
use PHPStan\TrinaryLogic;
10+
use PHPStan\Type\IsSuperTypeOfResult;
1011
use PHPStan\Type\ObjectType;
1112
use PHPStan\Type\Type;
1213

@@ -51,10 +52,10 @@ public function equals(Type $type): bool
5152
return parent::equals($type);
5253
}
5354

54-
public function isSuperTypeOf(Type $type): TrinaryLogic
55+
public function isSuperTypeOf(Type $type): IsSuperTypeOfResult
5556
{
5657
if ($type instanceof self) {
57-
return TrinaryLogic::createFromBoolean(
58+
return IsSuperTypeOfResult::createFromBoolean(
5859
$type->rowType !== null
5960
&& $this->rowType !== null
6061
&& $type->rowType->equals($this->rowType)

src/MysqliReflection/MysqliResultObjectType.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace staabm\PHPStanDba\MysqliReflection;
66

77
use PHPStan\TrinaryLogic;
8+
use PHPStan\Type\IsSuperTypeOfResult;
89
use PHPStan\Type\ObjectType;
910
use PHPStan\Type\Type;
1011

@@ -40,10 +41,10 @@ public function equals(Type $type): bool
4041
return parent::equals($type);
4142
}
4243

43-
public function isSuperTypeOf(Type $type): TrinaryLogic
44+
public function isSuperTypeOf(Type $type): IsSuperTypeOfResult
4445
{
4546
if ($type instanceof self) {
46-
return TrinaryLogic::createFromBoolean(
47+
return IsSuperTypeOfResult::createFromBoolean(
4748
$type->rowType !== null
4849
&& $this->rowType !== null
4950
&& $type->rowType->equals($this->rowType)

src/PdoReflection/PdoStatementObjectType.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use PHPStan\Type\FloatType;
1515
use PHPStan\Type\IntegerRangeType;
1616
use PHPStan\Type\IntegerType;
17+
use PHPStan\Type\IsSuperTypeOfResult;
1718
use PHPStan\Type\MixedType;
1819
use PHPStan\Type\NullType;
1920
use PHPStan\Type\ObjectType;
@@ -165,10 +166,10 @@ public function equals(Type $type): bool
165166
return parent::equals($type);
166167
}
167168

168-
public function isSuperTypeOf(Type $type): TrinaryLogic
169+
public function isSuperTypeOf(Type $type): IsSuperTypeOfResult
169170
{
170171
if ($type instanceof self) {
171-
return TrinaryLogic::createFromBoolean(
172+
return IsSuperTypeOfResult::createFromBoolean(
172173
$type->fetchType !== null
173174
&& $type->bothType !== null
174175
&& $this->bothType !== null

src/QueryReflection/QueryReflection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ public function isResolvable(Expr $queryExpr, Scope $scope): TrinaryLogic
206206
}
207207
$isStringOrMixed = $type->isSuperTypeOf(new StringType());
208208

209-
return $isStringOrMixed->negate();
209+
return $isStringOrMixed->negate()->result;
210210
}
211211

212212
/**

0 commit comments

Comments
 (0)