diff --git a/.github/workflows/tests.yaml b/.github/workflows/ci.yaml
similarity index 60%
rename from .github/workflows/tests.yaml
rename to .github/workflows/ci.yaml
index 2b0245f..d08ca06 100644
--- a/.github/workflows/tests.yaml
+++ b/.github/workflows/ci.yaml
@@ -1,4 +1,4 @@
-name: Tests
+name: CI
on:
pull_request: null
@@ -10,7 +10,7 @@ on:
jobs:
Tests:
- name: PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}${{ matrix.dependencies }}
+ name: PHP ${{ matrix.php }} Symfony ${{ matrix.symfony }}${{ matrix.description }}
runs-on: ubuntu-latest
env:
SYMFONY_DEPRECATIONS_HELPER: 'max[self]=0'
@@ -26,8 +26,7 @@ jobs:
php: '8.3'
- symfony: '^6.4'
php: '8.2'
- - description: 'Prefer lowest'
- php: '8.2'
+ - php: '8.2'
dependencies: '--prefer-lowest'
env:
SYMFONY_DEPRECATIONS_HELPER: 'disabled'
@@ -57,3 +56,30 @@ jobs:
files: './coverage.xml'
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
+ SA:
+ strategy:
+ matrix:
+ include:
+ - description: Validate composer.json
+ script: composer validate
+ - description: Code style
+ script: vendor/bin/php-cs-fixer fix --ansi --verbose --dry-run
+ - description: Rector
+ script: vendor/bin/rector --ansi --dry-run
+ - description: PHPStan
+ script: vendor/bin/phpstan analyze
+ - description: Psalm
+ script: vendor/bin/psalm
+
+ name: ${{ matrix.description }}
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Setup PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: 8.2
+ - name: Install dependencies
+ uses: "ramsey/composer-install@v3"
+ - run: ${{ matrix.script }}
diff --git a/.github/workflows/static-analysis.yaml b/.github/workflows/static-analysis.yaml
deleted file mode 100644
index 8f724cb..0000000
--- a/.github/workflows/static-analysis.yaml
+++ /dev/null
@@ -1,36 +0,0 @@
-name: Static analysis
-
-on:
- pull_request: ~
- push:
- branches:
- - master
- schedule:
- - cron: "45 7 * * 1"
-
-jobs:
- job:
- strategy:
- matrix:
- include:
- - description: Validate composer.json
- script: composer validate
- - description: Code style
- script: vendor/bin/php-cs-fixer fix --ansi --verbose --dry-run
- - description: PHPStan
- script: vendor/bin/phpstan analyze
- - description: Psalm
- script: vendor/bin/psalm
-
- name: ${{ matrix.description }}
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v4
- - name: Setup PHP
- uses: shivammathur/setup-php@v2
- with:
- php-version: 8.2
- - name: Install dependencies
- uses: "ramsey/composer-install@v3"
- - run: ${{ matrix.script }}
diff --git a/Makefile b/Makefile
index d95d22b..07e6bb3 100644
--- a/Makefile
+++ b/Makefile
@@ -13,6 +13,6 @@ phpstan:
vendor/bin/phpstan analyse
tests:
- vendor/bin/phpunit --verbose
+ vendor/bin/phpunit
.PHONY: tests
diff --git a/composer.json b/composer.json
index 77a95e3..24a735b 100644
--- a/composer.json
+++ b/composer.json
@@ -36,12 +36,13 @@
"require-dev": {
"facile-it/facile-coding-standard": "^1.2",
"jangregor/phpstan-prophecy": "2.2.0",
+ "phpspec/prophecy-phpunit": "^2.0",
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan": "2.1.17",
"phpstan/phpstan-phpunit": "2.0.6",
- "phpunit/phpunit": "^9.6.6",
- "phpspec/prophecy-phpunit": "^2.0",
+ "phpunit/phpunit": "^10 || ^11 || ^12",
+ "rector/rector": "2.0.17",
"symfony/phpunit-bridge": "^6.4 || ^7.0",
- "vimeo/psalm": "^4.6 || ^5.0"
+ "vimeo/psalm": "^6"
}
}
diff --git a/phpunit.xml b/phpunit.xml
index 423615a..a303a29 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -1,22 +1,22 @@
-
+ displayDetailsOnPhpunitDeprecations="true"
+ displayDetailsOnTestsThatTriggerDeprecations="true"
+ cacheDirectory=".phpunit.cache">
tests
-
-
+
src
-
+
diff --git a/psalm-baseline.xml b/psalm-baseline.xml
new file mode 100644
index 0000000..2724264
--- /dev/null
+++ b/psalm-baseline.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/psalm.xml b/psalm.xml
index 2dc2301..ed45698 100644
--- a/psalm.xml
+++ b/psalm.xml
@@ -5,6 +5,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
+ errorBaseline="psalm-baseline.xml"
>
@@ -12,4 +13,7 @@
+
+
+
diff --git a/rector.php b/rector.php
new file mode 100644
index 0000000..f8859fa
--- /dev/null
+++ b/rector.php
@@ -0,0 +1,21 @@
+withPaths([
+ __DIR__ . '/src',
+ __DIR__ . '/tests',
+ ])
+ // uncomment to reach your current PHP version
+ // ->withPhpSets()
+ ->withTypeCoverageLevel(0)
+ ->withDeadCodeLevel(0)
+ ->withCodeQualityLevel(0)
+ ->withAttributesSets(phpunit: true)
+ ->withSets([
+ \Rector\PHPUnit\Set\PHPUnitSetList::PHPUNIT_100,
+ ])
+;
diff --git a/tests/E2E/TerminateCommandTest.php b/tests/E2E/TerminateCommandTest.php
index 9509ce1..0035910 100644
--- a/tests/E2E/TerminateCommandTest.php
+++ b/tests/E2E/TerminateCommandTest.php
@@ -17,10 +17,9 @@ class TerminateCommandTest extends TestCase
private const STUB_COMMAND = 'stub:terminable:sleep';
/**
- * @dataProvider commandLineProvider
- *
* @param string[] $commandLine
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('commandLineProvider')]
public function testStubCommand(array $commandLine): void
{
$process = new Process($commandLine);
@@ -37,7 +36,7 @@ public function testStubCommand(array $commandLine): void
/**
* @return string[][][]
*/
- public function commandLineProvider(): array
+ public static function commandLineProvider(): array
{
return [
[
@@ -58,9 +57,7 @@ public function commandLineProvider(): array
];
}
- /**
- * @dataProvider provideSignals
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('provideSignals')]
public function testSignalsDuringCommandBody(int $signal, int $exitCode): void
{
$process = new Process([
@@ -87,9 +84,7 @@ public function testSignalsDuringCommandBody(int $signal, int $exitCode): void
$this->assertSame($exitCode, $process->getExitCode());
}
- /**
- * @dataProvider provideSignals
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('provideSignals')]
public function testSigTermDuringSleep(int $signal, int $exitCode): void
{
$process = new Process([
@@ -119,7 +114,7 @@ public function testSigTermDuringSleep(int $signal, int $exitCode): void
/**
* @return array
*/
- public function provideSignals(): array
+ public static function provideSignals(): array
{
return [
[SIGTERM, 143],
diff --git a/tests/Unit/AbstractTerminableCommandTest.php b/tests/Unit/AbstractTerminableCommandTest.php
index 04239ca..8a8b429 100644
--- a/tests/Unit/AbstractTerminableCommandTest.php
+++ b/tests/Unit/AbstractTerminableCommandTest.php
@@ -78,9 +78,7 @@ protected function commandBody(InputInterface $input, OutputInterface $output):
$stubCommand->run(new ArrayInput([]), $output->reveal());
}
- /**
- * @dataProvider signalProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('signalProvider')]
public function testReceiveSignalDuringCommandBody(int $signal): void
{
$stubCommand = new class ($signal) extends AbstractTerminableCommand {
@@ -112,9 +110,7 @@ protected function commandBody(InputInterface $input, OutputInterface $output):
$this->assertSame(143, $exitCode);
}
- /**
- * @dataProvider signalProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('signalProvider')]
public function testReceiveSignalBeforeCommandBody(int $signal): void
{
$stubCommand = $this->createStubTerminableCommand();
@@ -122,7 +118,7 @@ public function testReceiveSignalBeforeCommandBody(int $signal): void
$output = $this->prophesize(OutputInterface::class);
$output->writeln(Argument::containingString('Starting'), OutputInterface::VERBOSITY_VERBOSE)
->shouldBeCalledTimes(1)
- ->will(function () use ($stubCommand, $signal) {
+ ->will(function () use ($stubCommand, $signal): void {
$stubCommand->handleSignal($signal);
});
$output->writeln('Signal received, skipping execution', OutputInterface::VERBOSITY_NORMAL)
@@ -133,9 +129,7 @@ public function testReceiveSignalBeforeCommandBody(int $signal): void
$this->assertSame(143, $exitCode);
}
- /**
- * @dataProvider signalProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('signalProvider')]
public function testGetSubscribedSignals(int $signal): void
{
$stubCommand = $this->createStubTerminableCommand();
@@ -146,7 +140,7 @@ public function testGetSubscribedSignals(int $signal): void
/**
* @return array{0: int}[]
*/
- public function signalProvider(): array
+ public static function signalProvider(): array
{
return [
[SIGINT],