Skip to content

Commit 71c81d4

Browse files
More tests
1 parent 5b128c4 commit 71c81d4

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

tests/PHPStan/Analyser/nsrt/bug-13561.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,16 @@ function more_test(MyInterface $i): void {
3535
assertType("non-empty-array<string, 42|string|true>&hasOffsetValue('always_here', 42|true)", $b);
3636
assertType('true', isset($b['always_here']));
3737
}
38+
39+
/**
40+
* @param array{thing?: 'do', always_here: 42|true} $x
41+
*/
42+
function more_test_2(MyInterface $i, array $x): void {
43+
$a = $i->getArray() + $x;
44+
assertType("non-empty-array<string, 42|string|true>&hasOffsetValue('always_here', 42|string|true)", $a);
45+
assertType('true', isset($a['always_here']));
46+
47+
$b = $x + $i->getArray();
48+
assertType("non-empty-array<string, 42|string|true>&hasOffsetValue('always_here', 42|true)", $b);
49+
assertType('true', isset($b['always_here']));
50+
}

0 commit comments

Comments
 (0)