Skip to content

Commit 415c4a6

Browse files
authored
Fix union result with PdoStatement (#704)
1 parent 236aa94 commit 415c4a6

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

src/PdoReflection/PdoStatementObjectType.php

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -152,28 +152,27 @@ public static function createDefaultType(int $fetchType): Type
152152
// this means we need to implement equals() and isSuperTypeOf().
153153
public function equals(Type $type): bool
154154
{
155-
if (
156-
$type instanceof self
157-
&& $type->fetchType !== null
158-
&& $type->bothType !== null
159-
&& $this->bothType !== null
160-
) {
161-
return $type->fetchType === $this->fetchType && $type->bothType->equals($this->bothType);
155+
if ($type instanceof self) {
156+
return $type->fetchType !== null
157+
&& $type->bothType !== null
158+
&& $this->bothType !== null
159+
&& $type->fetchType === $this->fetchType
160+
&& $type->bothType->equals(
161+
$this->bothType
162+
);
162163
}
163164

164165
return parent::equals($type);
165166
}
166167

167168
public function isSuperTypeOf(Type $type): TrinaryLogic
168169
{
169-
if (
170-
$type instanceof self
171-
&& $type->fetchType !== null
172-
&& $type->bothType !== null
173-
&& $this->bothType !== null
174-
) {
170+
if ($type instanceof self) {
175171
return TrinaryLogic::createFromBoolean(
176-
$type->fetchType === $this->fetchType
172+
$type->fetchType !== null
173+
&& $type->bothType !== null
174+
&& $this->bothType !== null
175+
&& $type->fetchType === $this->fetchType
177176
&& $type->bothType->equals($this->bothType)
178177
);
179178
}

0 commit comments

Comments
 (0)