From 145866a856af05797dced5e245ce6e84c8f8e616 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Thu, 8 May 2025 14:25:03 +0200 Subject: [PATCH 1/2] use base LogicException --- src/ServerFactory.php | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/ServerFactory.php b/src/ServerFactory.php index af653c5..a4c28c2 100644 --- a/src/ServerFactory.php +++ b/src/ServerFactory.php @@ -3,32 +3,24 @@ namespace Innmind\Server\Status; -use Innmind\Server\Status\{ - Servers\OSX, - Servers\Linux, - Exception\UnsupportedOperatingSystem, +use Innmind\Server\Status\Servers\{ + OSX, + Linux, }; use Innmind\Server\Control\Server as Control; use Innmind\TimeContinuum\Clock; final class ServerFactory { - /** - * @throws UnsupportedOperatingSystem - */ public static function build( Clock $clock, Control $control, EnvironmentPath $path, ): Server { - switch (\PHP_OS) { - case 'Darwin': - return new OSX($clock, $control, $path); - - case 'Linux': - return new Linux($clock, $control); - } - - throw new UnsupportedOperatingSystem; + return match (\PHP_OS) { + 'Darwin' => new OSX($clock, $control, $path), + 'Linux' => new Linux($clock, $control), + default => throw new \LogicException('Unsupported operating system '.\PHP_OS), + }; } } From 6954545e7b8d1d55b8daa8895bb0af6582ed8dd2 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Thu, 8 May 2025 14:25:38 +0200 Subject: [PATCH 2/2] remove exceptions --- CHANGELOG.md | 3 +++ src/Exception/Exception.php | 8 -------- src/Exception/RuntimeException.php | 8 -------- src/Exception/UnsupportedOperatingSystem.php | 8 -------- 4 files changed, 3 insertions(+), 24 deletions(-) delete mode 100644 src/Exception/Exception.php delete mode 100644 src/Exception/RuntimeException.php delete mode 100644 src/Exception/UnsupportedOperatingSystem.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 807f169..a00846b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,9 @@ - `Innmind\Server\Status\Exception\EmptyUserNotAllowed` - `Innmind\Server\Status\Exception\LoadAverageCannotBeNegative` - `Innmind\Server\Status\Exception\DomainException` +- `Innmind\Server\Status\Exception\UnsupportedOperatingSystem` +- `Innmind\Server\Status\Exception\RuntimeException` +- `Innmind\Server\Status\Exception\Exception` ## 4.1.1 - 2024-09-30 diff --git a/src/Exception/Exception.php b/src/Exception/Exception.php deleted file mode 100644 index 90cfea4..0000000 --- a/src/Exception/Exception.php +++ /dev/null @@ -1,8 +0,0 @@ -