Skip to content

Commit fa4e8e4

Browse files
committed
Added regression tests
1 parent 5649b65 commit fa4e8e4

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
namespace Bug11322;
4+
5+
use function PHPStan\Testing\assertType;
6+
7+
function doFoo() {
8+
$result = ['map' => ['a' => 'b']];
9+
assertType("array{map: array{a: 'b'}}", $result);
10+
usort($result['map'], fn (string $a, string $b) => $a <=> $b);
11+
assertType("array{map: non-empty-list<'b'>}", $result);
12+
}

tests/PHPStan/Rules/Operators/InvalidBinaryOperationRuleTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,4 +807,11 @@ public function testBug7863(): void
807807
]);
808808
}
809809

810+
public function testBug10595(): void
811+
{
812+
$this->checkImplicitMixed = true;
813+
814+
$this->analyse([__DIR__ . '/data/bug-10595.php'], []);
815+
}
816+
810817
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace Bug10595;
4+
5+
function doFoo() {
6+
$test = [];
7+
$test[0] = [0, []];
8+
$test[0][1]['h'] = 'h';
9+
10+
foreach ($test as $value) {
11+
sort($value[1]);
12+
$value[1] = implode(',', $value[1]);
13+
$label = 'test' . $value[1];
14+
}
15+
}
16+

0 commit comments

Comments
 (0)