diff --git a/.github/workflows/code_analysis.yaml b/.github/workflows/code_analysis.yaml index 06f4c04..eca3935 100644 --- a/.github/workflows/code_analysis.yaml +++ b/.github/workflows/code_analysis.yaml @@ -40,14 +40,14 @@ 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: - php-version: 8.1 + php-version: 8.4 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 3583877..3fd8186 100644 --- a/README.md +++ b/README.md @@ -10,16 +10,10 @@ Speed up development of your PHP CLI Apps. Includes [7 Steps to Start with Paral 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) +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 -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). +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 92d9371..d0fe6f5 100644 --- a/composer.json +++ b/composer.json @@ -3,20 +3,21 @@ "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", + "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": "^6.0|^7.0|^8.0" }, "require-dev": { - "phpunit/phpunit": "^10.5", - "rector/rector": "^1.0", - "symplify/easy-coding-standard": "^12.1", - "tomasvotruba/class-leak": "^0.2.6" + "phpunit/phpunit": "^13.2", + "rector/jack": "^1.0", + "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 3f6510d..b363fad 100644 --- a/src/CommandLine/WorkerCommandLineFactory.php +++ b/src/CommandLine/WorkerCommandLineFactory.php @@ -13,21 +13,18 @@ * @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..984ca79 100644 --- a/src/CpuCoreCountProvider.php +++ b/src/CpuCoreCountProvider.php @@ -12,15 +12,13 @@ */ final class CpuCoreCountProvider { - /** - * @var int - */ - private const DEFAULT_CORE_COUNT = 2; + 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 24d90fa..ba82ad1 100644 --- a/src/Enum/Action.php +++ b/src/Enum/Action.php @@ -9,18 +9,9 @@ */ 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..d3a6f20 100644 --- a/src/Enum/Content.php +++ b/src/Enum/Content.php @@ -9,13 +9,7 @@ */ 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..cfe6230 100644 --- a/src/Enum/ReactCommand.php +++ b/src/Enum/ReactCommand.php @@ -9,13 +9,7 @@ */ 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..3906d51 100644 --- a/src/Enum/ReactEvent.php +++ b/src/Enum/ReactEvent.php @@ -9,23 +9,11 @@ */ 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..ed9fba6 100644 --- a/src/ValueObject/EasyParallelConfig.php +++ b/src/ValueObject/EasyParallelConfig.php @@ -9,8 +9,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..9b92f35 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; @@ -18,20 +19,15 @@ 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();