diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index edda121..7f6cd4d 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -9,19 +9,12 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - php: [8.2, 8.1, 8.0] - laravel: [10.*, 9.*, 8.*] + php: [8.3, 8.2] + laravel: [11.*] stability: [prefer-stable] include: - - laravel: 10.* - testbench: 8.* - - laravel: 9.* - testbench: 7.* - - laravel: 8.* - testbench: 6.* - exclude: - - laravel: 10.* - php: 8.0 + - laravel: 11.* + testbench: 9.* name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} diff --git a/composer.json b/composer.json index 98d0153..74a3cd0 100644 --- a/composer.json +++ b/composer.json @@ -16,17 +16,18 @@ } ], "require": { - "php": "^8.0", + "php": "^8.2", "spatie/laravel-package-tools": "^1.4.3", - "illuminate/contracts": "^8.35|^9.0|^10.0" + "illuminate/contracts": "^11.0", + "symfony/console": "^7.0" }, "require-dev": { "ext-pcntl": "*", - "brianium/paratest": "^6.2", - "nunomaduro/collision": "^5.3|^6.0", - "orchestra/testbench": "^6.16|^7.0|^8.0", - "pestphp/pest-plugin-laravel": "^1.3", - "phpunit/phpunit": "^9.5", + "brianium/paratest": "^6.2|^7.0", + "nunomaduro/collision": "^5.3|^6.0|^7.0|^8.0", + "orchestra/testbench": "^9.0", + "pestphp/pest-plugin-laravel": "^1.3|^2.0", + "phpunit/phpunit": "^9.5|^10|^11", "spatie/laravel-ray": "^1.17" }, "autoload": { diff --git a/src/SignalAwareCommand.php b/src/SignalAwareCommand.php index 9d6a15c..b239147 100644 --- a/src/SignalAwareCommand.php +++ b/src/SignalAwareCommand.php @@ -14,13 +14,15 @@ public function getSubscribedSignals(): array return array_merge($this->autoDiscoverSignals(), $this->handlesSignals ?? []); } - public function handleSignal(int $signal): void + public function handleSignal(int $signal, int|false $previousExitCode = 0): int|false { event(new SignalReceived($signal, $this)); $this ->executeRegisteredSignalHandlers($signal) ->handleSignalMethodOnCommandClass($signal); + + return $signal; } protected function executeRegisteredSignalHandlers(int $signal): self diff --git a/tests/SignalTest.php b/tests/SignalTest.php index a41b68d..ea8ff06 100644 --- a/tests/SignalTest.php +++ b/tests/SignalTest.php @@ -26,9 +26,11 @@ /** @var \Spatie\SignalAwareCommand\SignalAwareCommand $command */ $command = app()->make(TestCommand::class); - $command->handleSignal(SIGINT); + $result = $command->handleSignal(SIGINT); Event::assertDispatched(SignalReceived::class); + + expect($result)->toEqual(SIGINT); }); it('can clear registered handlers', function () {