From c013219b73339c1db35188e0b0b808a397359779 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Mon, 31 Jan 2022 23:02:48 +0100 Subject: [PATCH] More precise `array_chunk` signature --- resources/functionMap.php | 2 +- src/Parallel/Scheduler.php | 4 +++- tests/PHPStan/Parallel/SchedulerTest.php | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/resources/functionMap.php b/resources/functionMap.php index 06e4c5063a..3dae819935 100644 --- a/resources/functionMap.php +++ b/resources/functionMap.php @@ -259,7 +259,7 @@ 'AppendIterator::rewind' => ['void'], 'AppendIterator::valid' => ['bool'], 'array_change_key_case' => ['array', 'input'=>'array', 'case='=>'int'], -'array_chunk' => ['array[]', 'input'=>'array', 'size'=>'int', 'preserve_keys='=>'bool'], +'array_chunk' => ['array[]', 'input'=>'array', 'size'=>'positive-int', 'preserve_keys='=>'bool'], 'array_column' => ['array', 'array'=>'array', 'column_key'=>'mixed', 'index_key='=>'mixed'], 'array_combine' => ['array|false', 'keys'=>'array', 'values'=>'array'], 'array_count_values' => ['array', 'input'=>'array'], diff --git a/src/Parallel/Scheduler.php b/src/Parallel/Scheduler.php index a9cf735313..1ab1ce6666 100644 --- a/src/Parallel/Scheduler.php +++ b/src/Parallel/Scheduler.php @@ -10,7 +10,9 @@ class Scheduler { - + /** + * @param positive-int $jobSize + */ public function __construct( private int $jobSize, private int $maximumNumberOfProcesses, diff --git a/tests/PHPStan/Parallel/SchedulerTest.php b/tests/PHPStan/Parallel/SchedulerTest.php index 21b0e29843..0d63fc1380 100644 --- a/tests/PHPStan/Parallel/SchedulerTest.php +++ b/tests/PHPStan/Parallel/SchedulerTest.php @@ -72,6 +72,7 @@ public function dataSchedule(): array /** * @dataProvider dataSchedule + * @param positive-int $jobSize * @param 0|positive-int $numberOfFiles * @param array $expectedJobSizes */