diff --git a/.github/workflows/code_analysis.yaml b/.github/workflows/code_analysis.yaml index 55c4b3b..06f4c04 100644 --- a/.github/workflows/code_analysis.yaml +++ b/.github/workflows/code_analysis.yaml @@ -6,10 +6,6 @@ on: branches: - main -env: - # see https://github.com/composer/composer/issues/9368#issuecomment-718112361 - COMPOSER_ROOT_VERSION: "dev-main" - jobs: code_analysis: strategy: @@ -36,17 +32,9 @@ jobs: name: 'Tests' run: vendor/bin/phpunit - - - name: 'PHP Linter' - run: vendor/bin/parallel-lint src tests - - - - name: 'Check Commented Code' - run: vendor/bin/easy-ci check-commented-code src tests --ansi - - name: 'Check Active Classes' - run: vendor/bin/easy-ci check-active-class src --ansi + run: vendor/bin/class-leak check src --ansi name: ${{ matrix.actions.name }} runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index 49c63d2..789410c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ composer.lock -/vendor \ No newline at end of file +/vendor + +.phpunit.result.cache +.phpunit.cache diff --git a/composer.json b/composer.json index 47ba7e3..1ef03f2 100644 --- a/composer.json +++ b/composer.json @@ -5,23 +5,20 @@ "require": { "php": ">=8.1", "clue/ndjson-react": "^1.3", + "fidry/cpu-core-counter": "^0.4.0 || ^0.5.1", + "nette/utils": "^3.2|^4.0", "react/child-process": "^0.6.5", "react/event-loop": "^1.3", "react/socket": "^1.12", - "symfony/console": "^6.2", - "fidry/cpu-core-counter": "^0.4.0 || ^0.5.1" + "symfony/console": "^6.2|^7.0" }, "require-dev": { - "symplify/package-builder": "^11.2", - "phpunit/phpunit": "^9.5.26", - "php-parallel-lint/php-parallel-lint": "^1.3", - "phpstan/extension-installer": "^1.2", - "rector/rector": "^0.15.10", - "symplify/easy-ci": "^11.1", - "symplify/easy-coding-standard": "^11.1", - "symplify/phpstan-extensions": "^11.1", - "symplify/symplify-kernel": "^11.2", - "tomasvotruba/unused-public": "^0.0.34" + "phpstan/extension-installer": "^1.3", + "phpunit/phpunit": "^10.5", + "rector/rector": "^0.18.13", + "symplify/easy-coding-standard": "^12.0", + "symplify/phpstan-extensions": "^11.4", + "tomasvotruba/class-leak": "^0.2.6" }, "autoload": { "psr-4": { @@ -33,11 +30,6 @@ "Symplify\\EasyParallel\\Tests\\": "tests" } }, - "extra": { - "branch-alias": { - "dev-main": "11.2-dev" - } - }, "scripts": { "check-cs": "vendor/bin/ecs check --ansi", "fix-cs": "vendor/bin/ecs check --fix --ansi", @@ -51,7 +43,5 @@ "cweagans/composer-patches": true, "phpstan/extension-installer": true } - }, - "minimum-stability": "dev", - "prefer-stable": true + } } diff --git a/easy-ci.php b/easy-ci.php deleted file mode 100644 index ab0f668..0000000 --- a/easy-ci.php +++ /dev/null @@ -1,12 +0,0 @@ -typesToSkip([ - SerializableInterface::class, - ]); -}; diff --git a/ecs.php b/ecs.php index 4a64559..41f7398 100644 --- a/ecs.php +++ b/ecs.php @@ -10,7 +10,6 @@ __DIR__ . '/config', __DIR__ . '/ecs.php', __DIR__ . '/rector.php', - __DIR__ . '/easy-ci.php', __DIR__ . '/src', __DIR__ . '/tests', ]); diff --git a/phpstan.neon b/phpstan.neon index f87e44c..097c572 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -6,13 +6,8 @@ parameters: - tests excludePaths: - - '*/tests/**/Source/*' - - '*/tests/**/Fixture/*' - - unused_public: - methods: true - properties: true - constants: true + - '*/Source/*' + - '*/Fixture/*' ignoreErrors: - diff --git a/phpunit.xml b/phpunit.xml index 1ad6909..8652712 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,7 +1,9 @@ + tests diff --git a/src/Contract/SerializableInterface.php b/src/Contract/SerializableInterface.php index 5410e67..2ec4853 100644 --- a/src/Contract/SerializableInterface.php +++ b/src/Contract/SerializableInterface.php @@ -6,6 +6,9 @@ use JsonSerializable; +/** + * @api + */ interface SerializableInterface extends JsonSerializable { /** diff --git a/src/FileSystem/FilePathNormalizer.php b/src/FileSystem/FilePathNormalizer.php deleted file mode 100644 index a2928bb..0000000 --- a/src/FileSystem/FilePathNormalizer.php +++ /dev/null @@ -1,27 +0,0 @@ -getRelativeFilePathFromCwd(); - } - - return $filePaths; - } -} diff --git a/src/ValueObject/ParallelProcess.php b/src/ValueObject/ParallelProcess.php index b7a0362..4dcbfcd 100644 --- a/src/ValueObject/ParallelProcess.php +++ b/src/ValueObject/ParallelProcess.php @@ -146,7 +146,7 @@ public function bindConnection(Decoder $decoder, Encoder $encoder): void private function cancelTimer(): void { - if ($this->timer === null) { + if (! $this->timer instanceof TimerInterface) { return; } diff --git a/tests/CommandLine/Source/SomeService.php b/tests/CommandLine/Source/SomeService.php index c47d6fa..119b5f9 100644 --- a/tests/CommandLine/Source/SomeService.php +++ b/tests/CommandLine/Source/SomeService.php @@ -6,5 +6,4 @@ final class SomeService { - } diff --git a/tests/CommandLine/WorkerCommandLineFactoryTest.php b/tests/CommandLine/WorkerCommandLineFactoryTest.php index 5eae968..ad1b372 100644 --- a/tests/CommandLine/WorkerCommandLineFactoryTest.php +++ b/tests/CommandLine/WorkerCommandLineFactoryTest.php @@ -5,6 +5,7 @@ namespace Symplify\EasyParallel\Tests\CommandLine; use Iterator; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\ArrayInput; @@ -38,11 +39,10 @@ protected function setUp(): void } /** - * @dataProvider provideData() - * * @param class-string $commandClass * @param array $inputParameters */ + #[DataProvider('provideData')] public function test( string $commandClass, string $pathsOptionName, @@ -66,14 +66,11 @@ public function test( $this->assertSame($expectedCommand, $workerCommandLine); } - /** - * @return Iterator>|string[]> - */ - public function provideData(): Iterator + public static function provideData(): Iterator { $cliInputOptions = array_slice($_SERVER['argv'], 1); - $expectedCommandLinesString = $this->createExpectedCommandLinesString($cliInputOptions); + $expectedCommandLinesString = self::createExpectedCommandLinesString($cliInputOptions); yield [ MainCommand::class, @@ -119,7 +116,7 @@ private function prepareProcessCommandDefinition(string $mainCommandClass): Inpu /** * @param string[] $cliInputOptions */ - private function createExpectedCommandLinesString(array $cliInputOptions): string + private static function createExpectedCommandLinesString(array $cliInputOptions): string { $commandLineString = "'" . PHP_BINARY . "' '" . self::DUMMY_MAIN_SCRIPT . "'";