From 37a4822fa09faec0c6162f721e07cdeb2e737154 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Ha=C5=82as?= Date: Sun, 12 Apr 2026 07:46:31 +0200 Subject: [PATCH] Use standalone true type in methods that always return true (PHP 8.2) --- src/Http/Response/Strategy/DefaultResponseStrategy.php | 2 +- src/Reboot/Strategy/AlwaysRebootStrategy.php | 2 +- tests/RebootStrategyTest.php | 9 --------- tests/Strategy/DefaultResponseStrategyTest.php | 9 --------- 4 files changed, 2 insertions(+), 20 deletions(-) diff --git a/src/Http/Response/Strategy/DefaultResponseStrategy.php b/src/Http/Response/Strategy/DefaultResponseStrategy.php index c947b3e..e63a8ac 100644 --- a/src/Http/Response/Strategy/DefaultResponseStrategy.php +++ b/src/Http/Response/Strategy/DefaultResponseStrategy.php @@ -10,7 +10,7 @@ final class DefaultResponseStrategy implements ResponseConverterStrategyInterface { - public function supports(SymfonyResponse $response): bool + public function supports(SymfonyResponse $response): true { return true; } diff --git a/src/Reboot/Strategy/AlwaysRebootStrategy.php b/src/Reboot/Strategy/AlwaysRebootStrategy.php index f086948..bc4a993 100644 --- a/src/Reboot/Strategy/AlwaysRebootStrategy.php +++ b/src/Reboot/Strategy/AlwaysRebootStrategy.php @@ -6,7 +6,7 @@ final class AlwaysRebootStrategy implements RebootStrategyInterface { - public function shouldReboot(): bool + public function shouldReboot(): true { return true; } diff --git a/tests/RebootStrategyTest.php b/tests/RebootStrategyTest.php index ad50623..4526c0b 100644 --- a/tests/RebootStrategyTest.php +++ b/tests/RebootStrategyTest.php @@ -23,15 +23,6 @@ */ final class RebootStrategyTest extends TestCase { - public function testAlwaysRebootStrategyAlwaysReturnsTrue(): void - { - $strategy = new AlwaysRebootStrategy(); - - $this->assertTrue($strategy->shouldReboot()); - $this->assertTrue($strategy->shouldReboot()); - $this->assertTrue($strategy->shouldReboot()); - } - public function testMaxJobsRebootStrategyReturnsFalseUntilLimit(): void { $strategy = new MaxJobsRebootStrategy(3, 0); diff --git a/tests/Strategy/DefaultResponseStrategyTest.php b/tests/Strategy/DefaultResponseStrategyTest.php index 814801c..d7be385 100644 --- a/tests/Strategy/DefaultResponseStrategyTest.php +++ b/tests/Strategy/DefaultResponseStrategyTest.php @@ -6,19 +6,10 @@ use CrazyGoat\WorkermanBundle\Http\Response\Strategy\DefaultResponseStrategy; use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Response; final class DefaultResponseStrategyTest extends TestCase { - public function testSupportsAlwaysReturnsTrue(): void - { - $strategy = new DefaultResponseStrategy(); - - $this->assertTrue($strategy->supports(new Response())); - $this->assertTrue($strategy->supports(new JsonResponse(['test']))); - } - public function testConvertReturnsWorkermanResponseWithContent(): void { $strategy = new DefaultResponseStrategy();