Skip to content

Commit 20e7af5

Browse files
committed
Updated ECS to commit 3adffe1eb1e216144735783da33566c5adb34658
1 parent cdbafe7 commit 20e7af5

33 files changed

Lines changed: 158 additions & 368 deletions

src/Application/EasyCodingStandardApplication.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
use Symplify\EasyCodingStandard\FileSystem\StaticRelativeFilePathHelper;
1313
use Symplify\EasyCodingStandard\Finder\SourceFinder;
1414
use Symplify\EasyCodingStandard\Parallel\Application\ParallelFileProcessor;
15+
use Symplify\EasyCodingStandard\Parallel\CpuCoreCountProvider;
16+
use Symplify\EasyCodingStandard\Parallel\ScheduleFactory;
1517
use Symplify\EasyCodingStandard\Parallel\ValueObject\Bridge;
1618
use Symplify\EasyCodingStandard\SniffRunner\ValueObject\Error\CodingStandardError;
1719
use Symplify\EasyCodingStandard\Utils\ParametersMerger;
1820
use Symplify\EasyCodingStandard\ValueObject\Configuration;
1921
use Symplify\EasyCodingStandard\ValueObject\Error\FileDiff;
2022
use Symplify\EasyCodingStandard\ValueObject\Error\SystemError;
2123
use Symplify\EasyCodingStandard\ValueObject\Option;
22-
use ECSPrefix202606\Symplify\EasyParallel\CpuCoreCountProvider;
23-
use ECSPrefix202606\Symplify\EasyParallel\ScheduleFactory;
2424
final class EasyCodingStandardApplication
2525
{
2626
/**
@@ -50,7 +50,7 @@ final class EasyCodingStandardApplication
5050
private $singleFileProcessor;
5151
/**
5252
* @readonly
53-
* @var \Symplify\EasyParallel\ScheduleFactory
53+
* @var \Symplify\EasyCodingStandard\Parallel\ScheduleFactory
5454
*/
5555
private $scheduleFactory;
5656
/**
@@ -60,7 +60,7 @@ final class EasyCodingStandardApplication
6060
private $parallelFileProcessor;
6161
/**
6262
* @readonly
63-
* @var \Symplify\EasyParallel\CpuCoreCountProvider
63+
* @var \Symplify\EasyCodingStandard\Parallel\CpuCoreCountProvider
6464
*/
6565
private $cpuCoreCountProvider;
6666
/**

src/Application/Version/StaticVersionResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ final class StaticVersionResolver
1515
* @api
1616
* @var string
1717
*/
18-
public const PACKAGE_VERSION = '54eb0bcb1a037c7e785044a81fc94f6c1e7d45e1';
18+
public const PACKAGE_VERSION = '3adffe1eb1e216144735783da33566c5adb34658';
1919
/**
2020
* @api
2121
* @var string
2222
*/
23-
public const RELEASE_DATE = '2026-06-20 01:01:05';
23+
public const RELEASE_DATE = '2026-06-20 11:09:15';
2424
/**
2525
* @var int
2626
*/

src/Console/Command/WorkerCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
use Symplify\EasyCodingStandard\Console\ExitCode;
1515
use Symplify\EasyCodingStandard\Console\Output\ConsoleOutputFormatter;
1616
use Symplify\EasyCodingStandard\MemoryLimitter;
17+
use Symplify\EasyCodingStandard\Parallel\Enum\Action;
18+
use Symplify\EasyCodingStandard\Parallel\Enum\ReactCommand;
1719
use Symplify\EasyCodingStandard\Parallel\WorkerRunner;
18-
use ECSPrefix202606\Symplify\EasyParallel\Enum\Action;
19-
use ECSPrefix202606\Symplify\EasyParallel\Enum\ReactCommand;
2020
/**
2121
* Inspired at: https://github.com/phpstan/phpstan-src/commit/9124c66dcc55a222e21b1717ba5f60771f7dda92
2222
* https://github.com/phpstan/phpstan-src/blob/c471c7b050e0929daf432288770de673b394a983/src/Command/WorkerCommand.php

src/Parallel/Application/ParallelFileProcessor.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@
1111
use ECSPrefix202606\React\Socket\TcpServer;
1212
use Symplify\EasyCodingStandard\Console\ExitCode;
1313
use Symplify\EasyCodingStandard\DependencyInjection\SimpleParameterProvider;
14+
use Symplify\EasyCodingStandard\Parallel\CommandLine\WorkerCommandLineFactory;
15+
use Symplify\EasyCodingStandard\Parallel\Enum\Action;
16+
use Symplify\EasyCodingStandard\Parallel\Enum\Content;
17+
use Symplify\EasyCodingStandard\Parallel\Enum\ReactCommand;
18+
use Symplify\EasyCodingStandard\Parallel\Enum\ReactEvent;
1419
use Symplify\EasyCodingStandard\Parallel\ValueObject\Bridge;
20+
use Symplify\EasyCodingStandard\Parallel\ValueObject\ParallelProcess;
21+
use Symplify\EasyCodingStandard\Parallel\ValueObject\ProcessPool;
22+
use Symplify\EasyCodingStandard\Parallel\ValueObject\Schedule;
1523
use Symplify\EasyCodingStandard\SniffRunner\ValueObject\Error\CodingStandardError;
1624
use Symplify\EasyCodingStandard\ValueObject\Configuration;
1725
use Symplify\EasyCodingStandard\ValueObject\Error\FileDiff;
1826
use Symplify\EasyCodingStandard\ValueObject\Error\SystemError;
1927
use Symplify\EasyCodingStandard\ValueObject\Option;
20-
use ECSPrefix202606\Symplify\EasyParallel\CommandLine\WorkerCommandLineFactory;
21-
use ECSPrefix202606\Symplify\EasyParallel\Enum\Action;
22-
use ECSPrefix202606\Symplify\EasyParallel\Enum\Content;
23-
use ECSPrefix202606\Symplify\EasyParallel\Enum\ReactCommand;
24-
use ECSPrefix202606\Symplify\EasyParallel\Enum\ReactEvent;
25-
use ECSPrefix202606\Symplify\EasyParallel\ValueObject\ParallelProcess;
26-
use ECSPrefix202606\Symplify\EasyParallel\ValueObject\ProcessPool;
27-
use ECSPrefix202606\Symplify\EasyParallel\ValueObject\Schedule;
2828
use Throwable;
2929
/**
3030
* Inspired from @see
@@ -36,15 +36,15 @@ final class ParallelFileProcessor
3636
{
3737
/**
3838
* @readonly
39-
* @var \Symplify\EasyParallel\CommandLine\WorkerCommandLineFactory
39+
* @var \Symplify\EasyCodingStandard\Parallel\CommandLine\WorkerCommandLineFactory
4040
*/
4141
private $workerCommandLineFactory;
4242
/**
4343
* @var int
4444
*/
4545
private const SYSTEM_ERROR_LIMIT = 50;
4646
/**
47-
* @var \Symplify\EasyParallel\ValueObject\ProcessPool|null
47+
* @var \Symplify\EasyCodingStandard\Parallel\ValueObject\ProcessPool|null
4848
*/
4949
private $processPool = null;
5050
public function __construct(WorkerCommandLineFactory $workerCommandLineFactory)
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?php
2+
3+
declare (strict_types=1);
4+
namespace Symplify\EasyCodingStandard\Parallel\CommandLine;
5+
6+
final class WorkerCommandLineFactory
7+
{
8+
/**
9+
* @var string
10+
*/
11+
private const OPTION_DASHES = '--';
12+
/**
13+
* @param array<string, bool|string|null> $workerOptionValues option name => value, mirrored to the worker process
14+
* @param string[] $paths
15+
*/
16+
public function create(string $baseScript, string $workerCommandName, ?string $projectConfigFile, array $workerOptionValues, array $paths, string $identifier, int $port): string
17+
{
18+
$processCommandArray = [escapeshellarg(\PHP_BINARY), escapeshellarg($baseScript), $workerCommandName];
19+
if ($projectConfigFile !== null) {
20+
$processCommandArray[] = '--config';
21+
$processCommandArray[] = escapeshellarg($projectConfigFile);
22+
}
23+
foreach ($this->mirrorCommandOptions($workerOptionValues) as $processCommandOption) {
24+
$processCommandArray[] = $processCommandOption;
25+
}
26+
// for TCP local server
27+
$processCommandArray[] = '--port';
28+
$processCommandArray[] = (string) $port;
29+
$processCommandArray[] = '--identifier';
30+
$processCommandArray[] = escapeshellarg($identifier);
31+
foreach ($paths as $path) {
32+
$processCommandArray[] = escapeshellarg($path);
33+
}
34+
// set json output
35+
$processCommandArray[] = '--output-format';
36+
$processCommandArray[] = escapeshellarg('json');
37+
return implode(' ', $processCommandArray);
38+
}
39+
/**
40+
* @param array<string, bool|string|null> $workerOptionValues
41+
* @return string[]
42+
*/
43+
private function mirrorCommandOptions(array $workerOptionValues): array
44+
{
45+
$processCommandOptions = [];
46+
foreach ($workerOptionValues as $optionName => $optionValue) {
47+
// skip clutter
48+
if ($optionValue === null) {
49+
continue;
50+
}
51+
if (is_bool($optionValue)) {
52+
if ($optionValue) {
53+
$processCommandOptions[] = self::OPTION_DASHES . $optionName;
54+
}
55+
continue;
56+
}
57+
if ($optionName === 'memory-limit') {
58+
// does not accept -1 as value without assign
59+
$processCommandOptions[] = '--' . $optionName . '=' . $optionValue;
60+
} else {
61+
$processCommandOptions[] = self::OPTION_DASHES . $optionName;
62+
$processCommandOptions[] = escapeshellarg($optionValue);
63+
}
64+
}
65+
return $processCommandOptions;
66+
}
67+
}

vendor/symplify/easy-parallel/src/Contract/SerializableInterface.php renamed to src/Parallel/Contract/SerializableInterface.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
<?php
22

33
declare (strict_types=1);
4-
namespace ECSPrefix202606\Symplify\EasyParallel\Contract;
4+
namespace Symplify\EasyCodingStandard\Parallel\Contract;
55

66
use JsonSerializable;
7-
/**
8-
* @api
9-
*/
107
interface SerializableInterface extends JsonSerializable
118
{
129
/**

vendor/symplify/easy-parallel/src/CpuCoreCountProvider.php renamed to src/Parallel/CpuCoreCountProvider.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
<?php
22

33
declare (strict_types=1);
4-
namespace ECSPrefix202606\Symplify\EasyParallel;
4+
namespace Symplify\EasyCodingStandard\Parallel;
55

66
use ECSPrefix202606\Fidry\CpuCoreCounter\CpuCoreCounter;
77
use ECSPrefix202606\Fidry\CpuCoreCounter\NumberOfCpuCoreNotFound;
8-
/**
9-
* @api
10-
*/
118
final class CpuCoreCountProvider
129
{
1310
/**

vendor/symplify/easy-parallel/src/Enum/Action.php renamed to src/Parallel/Enum/Action.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
<?php
22

33
declare (strict_types=1);
4-
namespace ECSPrefix202606\Symplify\EasyParallel\Enum;
4+
namespace Symplify\EasyCodingStandard\Parallel\Enum;
55

6-
/**
7-
* @api
8-
*/
96
final class Action
107
{
118
/**

vendor/symplify/easy-parallel/src/Enum/Content.php renamed to src/Parallel/Enum/Content.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
<?php
22

33
declare (strict_types=1);
4-
namespace ECSPrefix202606\Symplify\EasyParallel\Enum;
4+
namespace Symplify\EasyCodingStandard\Parallel\Enum;
55

6-
/**
7-
* @api
8-
*/
96
final class Content
107
{
118
/**

vendor/symplify/easy-parallel/src/Enum/ReactCommand.php renamed to src/Parallel/Enum/ReactCommand.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
<?php
22

33
declare (strict_types=1);
4-
namespace ECSPrefix202606\Symplify\EasyParallel\Enum;
4+
namespace Symplify\EasyCodingStandard\Parallel\Enum;
55

6-
/**
7-
* @api
8-
*/
96
final class ReactCommand
107
{
118
/**

0 commit comments

Comments
 (0)