From 6acbd351857e660cb8e1d9dd97d0dbd27e7d6faf Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Thu, 14 Oct 2021 20:26:44 +0200 Subject: [PATCH] More precise array_chunk signature fix Scheduler fix cs type __construct() Update Scheduler.php adjust test --- resources/functionMap.php | 2 +- src/Parallel/Scheduler.php | 4 ++++ tests/PHPStan/Parallel/SchedulerTest.php | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/resources/functionMap.php b/resources/functionMap.php index 983e5edf564..4bc959fa0dc 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 ca1adcb9bf6..e0f369374fe 100644 --- a/src/Parallel/Scheduler.php +++ b/src/Parallel/Scheduler.php @@ -11,12 +11,16 @@ class Scheduler { + /** @var positive-int */ private int $jobSize; private int $maximumNumberOfProcesses; private int $minimumNumberOfJobsPerProcess; + /** + * @param positive-int $jobSize + */ public function __construct( int $jobSize, int $maximumNumberOfProcesses, diff --git a/tests/PHPStan/Parallel/SchedulerTest.php b/tests/PHPStan/Parallel/SchedulerTest.php index 21b0e29843e..0d63fc13806 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 */