Skip to content

Commit 4c0b46c

Browse files
committed
Update PdoStatementObjectType.php
1 parent cac1e07 commit 4c0b46c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/PdoReflection/PdoStatementObjectType.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use PDOStatement;
88
use PHPStan\ShouldNotHappenException;
9+
use PHPStan\TrinaryLogic;
910
use PHPStan\Type\ArrayType;
1011
use PHPStan\Type\BenevolentUnionType;
1112
use PHPStan\Type\Constant\ConstantArrayTypeBuilder;
@@ -145,4 +146,25 @@ public static function createDefaultType(int $fetchType): Type
145146

146147
return self::newWithBothAndFetchType(new MixedType(), $fetchType);
147148
}
149+
150+
public function equals(Type $type): bool
151+
{
152+
if ($type instanceof self) {
153+
return $type->fetchType === $this->fetchType && $type->bothType->equals($this->bothType);
154+
}
155+
156+
return parent::equals($type);
157+
}
158+
159+
public function isSuperTypeOf(Type $type): TrinaryLogic
160+
{
161+
if ($type instanceof self) {
162+
return TrinaryLogic::createFromBoolean(
163+
$type->fetchType === $this->fetchType
164+
&& $type->bothType->equals($this->bothType)
165+
);
166+
}
167+
168+
return parent::isSuperTypeOf($type);
169+
}
148170
}

0 commit comments

Comments
 (0)