Skip to content

Commit 2ff059d

Browse files
Rework
1 parent 43dc704 commit 2ff059d

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

src/Type/ArrayType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function __construct(Type $keyType, private Type $itemType)
5454
$keyType = new MixedType();
5555
}
5656
if ($keyType instanceof StrictMixedType && !$keyType instanceof TemplateStrictMixedType) {
57-
$keyType = new BenevolentUnionType([new IntegerType(), new StringType()]);
57+
$keyType = new UnionType([new StringType(), new IntegerType()]);
5858
}
5959

6060
$this->keyType = $keyType;

src/Type/Generic/TemplateTypeTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ public function inferTemplateTypes(Type $receivedType): TemplateTypeMap
289289
]))->union($map);
290290
}
291291

292-
if ($receivedType instanceof BenevolentUnionType) {
292+
if ($receivedType instanceof UnionType) {
293293
$matchingTypes = [];
294294
foreach ($receivedType->getTypes() as $innerType) {
295295
if (!$resolvedBound->isSuperTypeOf($innerType)->yes()) {

tests/PHPStan/Rules/Methods/CallStaticMethodsRuleTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,12 @@ public function testBug9732(): void
937937
$this->checkExplicitMixed = true;
938938
$this->checkImplicitMixed = true;
939939

940-
$this->analyse([__DIR__ . '/data/bug-9732.php'], []);
940+
$this->analyse([__DIR__ . '/data/bug-9732.php'], [
941+
[
942+
'Parameter #1 $array of static method Bug9732\HelloWorld::stringifyKeys() expects array<string, mixed>, array<mixed> given.',
943+
21,
944+
],
945+
]);
941946
}
942947

943948
#[RequiresPhp('>= 8.5')]

0 commit comments

Comments
 (0)