Skip to content

Commit 2f36068

Browse files
Rework
1 parent 43dc704 commit 2f36068

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
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 & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
77
use PHPStan\TrinaryLogic;
88
use PHPStan\Type\AcceptsResult;
9-
use PHPStan\Type\BenevolentUnionType;
109
use PHPStan\Type\ErrorType;
1110
use PHPStan\Type\IntersectionType;
1211
use PHPStan\Type\IsSuperTypeOfResult;
@@ -289,7 +288,7 @@ public function inferTemplateTypes(Type $receivedType): TemplateTypeMap
289288
]))->union($map);
290289
}
291290

292-
if ($receivedType instanceof BenevolentUnionType) {
291+
if ($receivedType instanceof UnionType) {
293292
$matchingTypes = [];
294293
foreach ($receivedType->getTypes() as $innerType) {
295294
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)