Skip to content

Commit 0596422

Browse files
Non regression test
1 parent d1e7426 commit 0596422

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

tests/PHPStan/Rules/Comparison/ImpossibleCheckTypeFunctionCallRuleTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,6 +1100,12 @@ public function testBug10394(): void
11001100
$this->analyse([__DIR__ . '/data/bug-10394.php'], []);
11011101
}
11021102

1103+
public function testBug12930(): void
1104+
{
1105+
$this->treatPhpDocTypesAsCertain = true;
1106+
$this->analyse([__DIR__ . '/data/bug-12930.php'], []);
1107+
}
1108+
11031109
public function testBug13628(): void
11041110
{
11051111
$this->treatPhpDocTypesAsCertain = true;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace Bug12930;
4+
5+
/** @return mixed */
6+
function getMixed() {return \stdClass::class;}
7+
8+
$val = getMixed();
9+
if (is_string($val) && !is_a($val, \stdClass::class, true)) {
10+
throw new \Exception();
11+
}
12+
13+
echo is_string($val) ? 'string' : 'something else';

tests/PHPStan/Type/TypeCombinatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2136,7 +2136,7 @@ public static function dataUnion(): iterable
21362136
[
21372137
[
21382138
new ArrayType(new MixedType(), new StringType()),
2139-
new MixedType(false, new ArrayType(new MixedType(), new MixedType())),
2139+
new MixedType(subtractedType: new ArrayType(new MixedType(), new MixedType())),
21402140
],
21412141
MixedType::class,
21422142
'mixed=implicit',

0 commit comments

Comments
 (0)