Skip to content

Commit 8491b70

Browse files
authored
Merge branch refs/heads/1.12.x into 2.0.x
2 parents 6629655 + e3ee899 commit 8491b70

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

src/Analyser/MutatingScope.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,9 +1126,6 @@ private function resolveType(string $exprString, Expr $node): Type
11261126
}
11271127

11281128
$resultType = $this->initializerExprTypeResolver->resolveConcatType($resultType, $partType);
1129-
if (count($resultType->getConstantStrings()) === 0) {
1130-
return $resultType;
1131-
}
11321129
}
11331130

11341131
return $resultType ?? new ConstantStringType('');

tests/PHPStan/Rules/Comparison/MatchExpressionRuleTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,4 +494,13 @@ public function testBug9436(): void
494494
$this->analyse([__DIR__ . '/data/bug-9436.php'], []);
495495
}
496496

497+
public function testBug11852(): void
498+
{
499+
if (PHP_VERSION_ID < 80000) {
500+
$this->markTestSkipped('Test requires PHP 8.0.');
501+
}
502+
503+
$this->analyse([__DIR__ . '/data/bug-11852.php'], []);
504+
}
505+
497506
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php // lint >= 8.0
2+
3+
namespace Bug11852;
4+
5+
function sayHello(int $type, string $activity): int
6+
{
7+
return match("$type:$activity") {
8+
'159:Work' => 12,
9+
'159:education' => 19,
10+
11+
default => throw new \InvalidArgumentException("unknown values $type:$activity"),
12+
};
13+
}

0 commit comments

Comments
 (0)