Skip to content

Commit 4a54afc

Browse files
committed
fix
1 parent 74e94fe commit 4a54afc

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/Type/Constant/ConstantArrayType.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,10 +371,8 @@ public function isSuperTypeOf(Type $type): TrinaryLogic
371371
$this->isList->yes()
372372
&& $type->isList->yes()
373373
&& count($this->keyTypes) !== count($type->keyTypes)
374+
&& count($type->optionalKeys) === 0
374375
) {
375-
if (count($type->optionalKeys) > 0) {
376-
return TrinaryLogic::createMaybe();
377-
}
378376
return TrinaryLogic::createNo();
379377
}
380378

tests/PHPStan/Analyser/nsrt/bug11488.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ protected function testOptionalKeys(array $row): void
2424
}
2525

2626
if (count($row) !== 3) {
27-
assertType('array{0: mixed, 1?: string|null}', $row);
27+
// should be array{0: mixed, 1?: string|null}
28+
assertType('array{0: mixed, 1?: mixed}', $row);
2829
}
2930
}
3031

0 commit comments

Comments
 (0)