From c416825d0bda3969ec17f17b54b187f4757ec077 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 | 10 ++++++++++ tests/PHPStan/Parallel/SchedulerTest.php | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/resources/functionMap.php b/resources/functionMap.php index d877e89299..03b33d82c0 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..99b66baf84 100644 --- a/src/Parallel/Scheduler.php +++ b/src/Parallel/Scheduler.php @@ -11,6 +11,16 @@ class Scheduler { + /** @var positive-int */ + private int $jobSize; + + private int $maximumNumberOfProcesses; + + private int $minimumNumberOfJobsPerProcess; + + /** + * @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 */