Skip to content

Commit 4f2baaf

Browse files
committed
more tests
1 parent 45b2712 commit 4f2baaf

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

tests/PHPStan/Rules/Methods/data/bug-14549.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
use function PHPStan\Testing\assertType;
66

7-
class MondayMorning
7+
class Foo
88
{
99
/**
1010
* @param callable-array $task
1111
*/
12-
public function call(array $task): void
12+
public function doFoo(array $task): void
1313
{
1414
foreach($task as $k => $v) {
1515
assertType('0|1', $k);
@@ -18,6 +18,22 @@ public function call(array $task): void
1818
assertType('class-string|object', $task[0]);
1919
assertType('string', $task[1]);
2020
}
21+
22+
/**
23+
* @param non-empty-list<string> $list
24+
*/
25+
public function doBar(array $list): void
26+
{
27+
if ($list[0] !== '') {
28+
assertType('non-empty-list<string>&hasOffsetValue(0, non-empty-string)', $list);
29+
30+
if (is_callable($list)) {
31+
assertType('non-empty-list<string>&callable(): mixed&hasOffsetValue(0, non-empty-string)', $list);
32+
assertType('non-empty-string', $list[0]);
33+
assertType('string', $list[1]);
34+
}
35+
}
36+
}
2137
}
2238

2339

0 commit comments

Comments
 (0)