Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/code_analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

<br>

## 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).
21 changes: 11 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
8 changes: 2 additions & 6 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
19 changes: 10 additions & 9 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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/*']);
11 changes: 4 additions & 7 deletions src/CommandLine/WorkerCommandLineFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
8 changes: 3 additions & 5 deletions src/CpuCoreCountProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
15 changes: 3 additions & 12 deletions src/Enum/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
10 changes: 2 additions & 8 deletions src/Enum/Content.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
10 changes: 2 additions & 8 deletions src/Enum/ReactCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
20 changes: 4 additions & 16 deletions src/Enum/ReactEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
5 changes: 1 addition & 4 deletions src/ValueObject/EasyParallelConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
6 changes: 3 additions & 3 deletions src/ValueObject/Schedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
*
* @api
*/
final class Schedule
final readonly class Schedule
{
/**
* @param array<array<string>> $jobs
*/
public function __construct(
private readonly int $numberOfProcesses,
private readonly array $jobs
private int $numberOfProcesses,
private array $jobs
) {
}

Expand Down
12 changes: 4 additions & 8 deletions tests/CommandLine/WorkerCommandLineFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down
Loading