From d5dc43b5f1465dae99c2d2dddd23cb44f27680a8 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Thu, 11 Jun 2026 14:12:25 +0200 Subject: [PATCH 1/3] bump to PHP 8.4 --- .github/workflows/code_analysis.yaml | 2 +- composer.json | 2 +- src/CommandLine/WorkerCommandLineFactory.php | 8 ++++---- src/CpuCoreCountProvider.php | 2 +- src/Enum/Action.php | 6 +++--- src/Enum/Content.php | 4 ++-- src/Enum/ReactCommand.php | 4 ++-- src/Enum/ReactEvent.php | 8 ++++---- src/ValueObject/EasyParallelConfig.php | 2 +- src/ValueObject/Schedule.php | 6 +++--- tests/CommandLine/WorkerCommandLineFactoryTest.php | 6 ++++-- 11 files changed, 26 insertions(+), 24 deletions(-) diff --git a/.github/workflows/code_analysis.yaml b/.github/workflows/code_analysis.yaml index 06f4c04..e3e9803 100644 --- a/.github/workflows/code_analysis.yaml +++ b/.github/workflows/code_analysis.yaml @@ -44,7 +44,7 @@ jobs: # see https://github.com/shivammathur/setup-php - uses: shivammathur/setup-php@v2 with: - php-version: 8.1 + php-version: 8.4 coverage: none # composer install cache - https://github.com/ramsey/composer-install diff --git a/composer.json b/composer.json index 92d9371..6abb53e 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "Helper package for easier CLI project parallelization", "license": "MIT", "require": { - "php": ">=8.1", + "php": ">=8.4", "clue/ndjson-react": "^1.3", "fidry/cpu-core-counter": "^0.5.1|^1.1", "nette/utils": "^3.2|^4.0", diff --git a/src/CommandLine/WorkerCommandLineFactory.php b/src/CommandLine/WorkerCommandLineFactory.php index 3f6510d..a198fe4 100644 --- a/src/CommandLine/WorkerCommandLineFactory.php +++ b/src/CommandLine/WorkerCommandLineFactory.php @@ -13,21 +13,21 @@ * @api * @see \Symplify\EasyParallel\Tests\CommandLine\WorkerCommandLineFactoryTest */ -final class WorkerCommandLineFactory +final readonly class WorkerCommandLineFactory { /** * @var string */ - private const OPTION_DASHES = '--'; + private const string OPTION_DASHES = '--'; /** * These options are not relevant for nested worker command line. * * @var string[] */ - private const EXCLUDED_OPTION_NAMES = ['output-format']; + private const array EXCLUDED_OPTION_NAMES = ['output-format']; - private readonly CommandFromReflectionFactory $commandFromReflectionFactory; + private CommandFromReflectionFactory $commandFromReflectionFactory; public function __construct() { diff --git a/src/CpuCoreCountProvider.php b/src/CpuCoreCountProvider.php index 2ba4cdb..c3406d6 100644 --- a/src/CpuCoreCountProvider.php +++ b/src/CpuCoreCountProvider.php @@ -15,7 +15,7 @@ final class CpuCoreCountProvider /** * @var int */ - private const DEFAULT_CORE_COUNT = 2; + private const int DEFAULT_CORE_COUNT = 2; public function provide(): int { diff --git a/src/Enum/Action.php b/src/Enum/Action.php index 24d90fa..dcee18c 100644 --- a/src/Enum/Action.php +++ b/src/Enum/Action.php @@ -12,15 +12,15 @@ final class Action /** * @var string */ - public const HELLO = 'hello'; + public const string HELLO = 'hello'; /** * @var string */ - public const MAIN = 'main'; + public const string MAIN = 'main'; /** * @var string */ - public const RESULT = 'result'; + public const string RESULT = 'result'; } diff --git a/src/Enum/Content.php b/src/Enum/Content.php index a7fea16..31b2c5f 100644 --- a/src/Enum/Content.php +++ b/src/Enum/Content.php @@ -12,10 +12,10 @@ final class Content /** * @var string */ - public const RESULT = 'result'; + public const string RESULT = 'result'; /** * @var string */ - public const FILES = 'files'; + public const string FILES = 'files'; } diff --git a/src/Enum/ReactCommand.php b/src/Enum/ReactCommand.php index 7988129..4629105 100644 --- a/src/Enum/ReactCommand.php +++ b/src/Enum/ReactCommand.php @@ -12,10 +12,10 @@ final class ReactCommand /** * @var string */ - public const ACTION = 'action'; + public const string ACTION = 'action'; /** * @var string */ - public const IDENTIFIER = 'identifier'; + public const string IDENTIFIER = 'identifier'; } diff --git a/src/Enum/ReactEvent.php b/src/Enum/ReactEvent.php index b57cc5d..0488cf3 100644 --- a/src/Enum/ReactEvent.php +++ b/src/Enum/ReactEvent.php @@ -12,20 +12,20 @@ final class ReactEvent /** * @var string */ - public const EXIT = 'exit'; + public const string EXIT = 'exit'; /** * @var string */ - public const DATA = 'data'; + public const string DATA = 'data'; /** * @var string */ - public const ERROR = 'error'; + public const string ERROR = 'error'; /** * @var string */ - public const CONNECTION = 'connection'; + public const string CONNECTION = 'connection'; } diff --git a/src/ValueObject/EasyParallelConfig.php b/src/ValueObject/EasyParallelConfig.php index d04f8ca..a8112d5 100644 --- a/src/ValueObject/EasyParallelConfig.php +++ b/src/ValueObject/EasyParallelConfig.php @@ -12,5 +12,5 @@ final class EasyParallelConfig /** * @var string */ - public const FILE_PATH = __DIR__ . '/../../config/config.php'; + public const string FILE_PATH = __DIR__ . '/../../config/config.php'; } diff --git a/src/ValueObject/Schedule.php b/src/ValueObject/Schedule.php index ca1c92f..678e20a 100644 --- a/src/ValueObject/Schedule.php +++ b/src/ValueObject/Schedule.php @@ -10,14 +10,14 @@ * * @api */ -final class Schedule +final readonly class Schedule { /** * @param array> $jobs */ public function __construct( - private readonly int $numberOfProcesses, - private readonly array $jobs + private int $numberOfProcesses, + private array $jobs ) { } diff --git a/tests/CommandLine/WorkerCommandLineFactoryTest.php b/tests/CommandLine/WorkerCommandLineFactoryTest.php index ad1b372..cedc5d4 100644 --- a/tests/CommandLine/WorkerCommandLineFactoryTest.php +++ b/tests/CommandLine/WorkerCommandLineFactoryTest.php @@ -5,6 +5,7 @@ namespace Symplify\EasyParallel\Tests\CommandLine; use Iterator; +use Override; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Command\Command; @@ -21,17 +22,18 @@ final class WorkerCommandLineFactoryTest extends TestCase /** * @var string */ - private const COMMAND = 'command'; + private const string COMMAND = 'command'; /** * @var string */ - private const DUMMY_MAIN_SCRIPT = 'main_script'; + private const string DUMMY_MAIN_SCRIPT = 'main_script'; private WorkerCommandLineFactory $workerCommandLineFactory; private CommandFromReflectionFactory $commandFromReflectionFactory; + #[Override] protected function setUp(): void { $this->workerCommandLineFactory = new WorkerCommandLineFactory(); From 0e610ab9aa5f8fdda3a45da80366c06246203e9b Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Thu, 11 Jun 2026 14:13:26 +0200 Subject: [PATCH 2/3] bump --- README.md | 10 ---------- composer.json | 15 ++++++++------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 3583877..f311fb6 100644 --- a/README.md +++ b/README.md @@ -13,13 +13,3 @@ composer require symplify/easy-parallel --dev ## Usage @todo - -
- -## Report Issues - -In case you are experiencing a bug or want to request a new feature head over to the [Symplify monorepo issue tracker](https://github.com/symplify/symplify/issues) - -## Contribute - -The sources of this package are contained in the Symplify monorepo. We welcome contributions for this package on [symplify/symplify](https://github.com/symplify/symplify). diff --git a/composer.json b/composer.json index 6abb53e..1e99a8e 100644 --- a/composer.json +++ b/composer.json @@ -5,17 +5,18 @@ "require": { "php": ">=8.4", "clue/ndjson-react": "^1.3", - "fidry/cpu-core-counter": "^0.5.1|^1.1", - "nette/utils": "^3.2|^4.0", + "fidry/cpu-core-counter": "^1.3", + "nette/utils": "^4.1", "react/child-process": "^0.6.5", - "react/event-loop": "^1.5", - "react/socket": "^1.15", - "symfony/console": "^6.2|^7.0" + "react/event-loop": "^1.6", + "react/socket": "^1.17", + "symfony/console": "^7.4" }, "require-dev": { "phpunit/phpunit": "^10.5", - "rector/rector": "^1.0", - "symplify/easy-coding-standard": "^12.1", + "rector/jack": "^1.0", + "rector/rector": "^1.2", + "symplify/easy-coding-standard": "^12.6", "tomasvotruba/class-leak": "^0.2.6" }, "autoload": { From 17c3de7bf968266d210e8fd2a6e6e5bd55f4e8ea Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Thu, 11 Jun 2026 14:24:20 +0200 Subject: [PATCH 3/3] update README --- .github/workflows/code_analysis.yaml | 4 ++-- README.md | 8 ++++++-- composer.json | 10 +++++----- ecs.php | 8 ++------ rector.php | 19 ++++++++++--------- src/CommandLine/WorkerCommandLineFactory.php | 3 --- src/CpuCoreCountProvider.php | 6 ++---- src/Enum/Action.php | 9 --------- src/Enum/Content.php | 6 ------ src/Enum/ReactCommand.php | 6 ------ src/Enum/ReactEvent.php | 12 ------------ src/ValueObject/EasyParallelConfig.php | 3 --- .../WorkerCommandLineFactoryTest.php | 6 ------ 13 files changed, 27 insertions(+), 73 deletions(-) diff --git a/.github/workflows/code_analysis.yaml b/.github/workflows/code_analysis.yaml index e3e9803..eca3935 100644 --- a/.github/workflows/code_analysis.yaml +++ b/.github/workflows/code_analysis.yaml @@ -40,7 +40,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # see https://github.com/shivammathur/setup-php - uses: shivammathur/setup-php@v2 with: @@ -48,6 +48,6 @@ jobs: coverage: none # composer install cache - https://github.com/ramsey/composer-install - - uses: "ramsey/composer-install@v2" + - uses: "ramsey/composer-install@v3" - run: ${{ matrix.actions.run }} diff --git a/README.md b/README.md index f311fb6..3fd8186 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,10 @@ Speed up development of your PHP CLI Apps. Includes [7 Steps to Start with Paral composer require symplify/easy-parallel --dev ``` -## Usage +## Report Issues -@todo +In case you are experiencing a bug or want to request a new feature, head over to the [issue tracker](https://github.com/symplify/easy-parallel/issues). + +## Contribute + +We welcome contributions. Open a pull request on [symplify/easy-parallel](https://github.com/symplify/easy-parallel). diff --git a/composer.json b/composer.json index 1e99a8e..d0fe6f5 100644 --- a/composer.json +++ b/composer.json @@ -10,14 +10,14 @@ "react/child-process": "^0.6.5", "react/event-loop": "^1.6", "react/socket": "^1.17", - "symfony/console": "^7.4" + "symfony/console": "^6.0|^7.0|^8.0" }, "require-dev": { - "phpunit/phpunit": "^10.5", + "phpunit/phpunit": "^13.2", "rector/jack": "^1.0", - "rector/rector": "^1.2", - "symplify/easy-coding-standard": "^12.6", - "tomasvotruba/class-leak": "^0.2.6" + "rector/rector": "^2.4.5", + "symplify/easy-coding-standard": "^13.2.1", + "tomasvotruba/class-leak": "^2.1" }, "autoload": { "psr-4": { diff --git a/ecs.php b/ecs.php index 00d9e79..7802a43 100644 --- a/ecs.php +++ b/ecs.php @@ -5,10 +5,6 @@ use Symplify\EasyCodingStandard\Config\ECSConfig; return ECSConfig::configure() - ->withPaths([ - __DIR__ . '/config', - __DIR__ . '/src', - __DIR__ . '/tests', - ]) + ->withPaths([__DIR__ . '/config', __DIR__ . '/src', __DIR__ . '/tests']) ->withRootFiles() - ->withPreparedSets(common: true, psr12: true); + ->withPreparedSets(common: true, psr12: true, symplify: true); diff --git a/rector.php b/rector.php index 41f1359..9964258 100644 --- a/rector.php +++ b/rector.php @@ -5,14 +5,15 @@ use Rector\Config\RectorConfig; return RectorConfig::configure() - ->withPreparedSets(codeQuality: true, deadCode: true, codingStyle: true, naming: true, privatization: true, earlyReturn: true) - ->withPaths([ - __DIR__ . '/config', - __DIR__ . '/src', - __DIR__ . '/tests', - ]) + ->withPreparedSets( + codeQuality: true, + deadCode: true, + codingStyle: true, + naming: true, + privatization: true, + earlyReturn: true + ) + ->withPaths([__DIR__ . '/config', __DIR__ . '/src', __DIR__ . '/tests']) ->withImportNames(removeUnusedImports: true) ->withPhpSets() - ->withSkip([ - '*/Source/*', - ]); + ->withSkip(['*/Source/*']); diff --git a/src/CommandLine/WorkerCommandLineFactory.php b/src/CommandLine/WorkerCommandLineFactory.php index a198fe4..b363fad 100644 --- a/src/CommandLine/WorkerCommandLineFactory.php +++ b/src/CommandLine/WorkerCommandLineFactory.php @@ -15,9 +15,6 @@ */ final readonly class WorkerCommandLineFactory { - /** - * @var string - */ private const string OPTION_DASHES = '--'; /** diff --git a/src/CpuCoreCountProvider.php b/src/CpuCoreCountProvider.php index c3406d6..984ca79 100644 --- a/src/CpuCoreCountProvider.php +++ b/src/CpuCoreCountProvider.php @@ -12,15 +12,13 @@ */ final class CpuCoreCountProvider { - /** - * @var int - */ private const int DEFAULT_CORE_COUNT = 2; public function provide(): int { try { - return (new CpuCoreCounter())->getCount(); + return new CpuCoreCounter() + ->getCount(); } catch (NumberOfCpuCoreNotFound) { return self::DEFAULT_CORE_COUNT; } diff --git a/src/Enum/Action.php b/src/Enum/Action.php index dcee18c..ba82ad1 100644 --- a/src/Enum/Action.php +++ b/src/Enum/Action.php @@ -9,18 +9,9 @@ */ final class Action { - /** - * @var string - */ public const string HELLO = 'hello'; - /** - * @var string - */ public const string MAIN = 'main'; - /** - * @var string - */ public const string RESULT = 'result'; } diff --git a/src/Enum/Content.php b/src/Enum/Content.php index 31b2c5f..d3a6f20 100644 --- a/src/Enum/Content.php +++ b/src/Enum/Content.php @@ -9,13 +9,7 @@ */ final class Content { - /** - * @var string - */ public const string RESULT = 'result'; - /** - * @var string - */ public const string FILES = 'files'; } diff --git a/src/Enum/ReactCommand.php b/src/Enum/ReactCommand.php index 4629105..cfe6230 100644 --- a/src/Enum/ReactCommand.php +++ b/src/Enum/ReactCommand.php @@ -9,13 +9,7 @@ */ final class ReactCommand { - /** - * @var string - */ public const string ACTION = 'action'; - /** - * @var string - */ public const string IDENTIFIER = 'identifier'; } diff --git a/src/Enum/ReactEvent.php b/src/Enum/ReactEvent.php index 0488cf3..3906d51 100644 --- a/src/Enum/ReactEvent.php +++ b/src/Enum/ReactEvent.php @@ -9,23 +9,11 @@ */ final class ReactEvent { - /** - * @var string - */ public const string EXIT = 'exit'; - /** - * @var string - */ public const string DATA = 'data'; - /** - * @var string - */ public const string ERROR = 'error'; - /** - * @var string - */ public const string CONNECTION = 'connection'; } diff --git a/src/ValueObject/EasyParallelConfig.php b/src/ValueObject/EasyParallelConfig.php index a8112d5..ed9fba6 100644 --- a/src/ValueObject/EasyParallelConfig.php +++ b/src/ValueObject/EasyParallelConfig.php @@ -9,8 +9,5 @@ */ final class EasyParallelConfig { - /** - * @var string - */ public const string FILE_PATH = __DIR__ . '/../../config/config.php'; } diff --git a/tests/CommandLine/WorkerCommandLineFactoryTest.php b/tests/CommandLine/WorkerCommandLineFactoryTest.php index cedc5d4..9b92f35 100644 --- a/tests/CommandLine/WorkerCommandLineFactoryTest.php +++ b/tests/CommandLine/WorkerCommandLineFactoryTest.php @@ -19,14 +19,8 @@ final class WorkerCommandLineFactoryTest extends TestCase { - /** - * @var string - */ private const string COMMAND = 'command'; - /** - * @var string - */ private const string DUMMY_MAIN_SCRIPT = 'main_script'; private WorkerCommandLineFactory $workerCommandLineFactory;