-
Notifications
You must be signed in to change notification settings - Fork 472
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix native return type of array_chunk
- Loading branch information
1 parent
7cb4901
commit e4a6d20
Showing
3 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace Bug8956; | ||
|
||
use function PHPStan\Testing\assertNativeType; | ||
use function PHPStan\Testing\assertType; | ||
|
||
class Foo | ||
{ | ||
|
||
public function doFoo(): void | ||
{ | ||
foreach (array_chunk(range(0, 10), 60) as $chunk) { | ||
assertType('array{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}', $chunk); | ||
assertNativeType('array', $chunk); | ||
foreach ($chunk as $val) { | ||
assertType('0|1|2|3|4|5|6|7|8|9|10', $val); | ||
assertNativeType('mixed', $val); | ||
} | ||
} | ||
} | ||
|
||
public function doBar(): void | ||
{ | ||
assertType('array{array{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}', array_chunk(range(0, 10), 60)); | ||
assertNativeType('list<array>', array_chunk(range(0, 10), 60)); | ||
} | ||
|
||
} |