From 0d5dd21bf68076f4525af368250f23bd835e8896 Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Tue, 5 Dec 2023 23:18:42 +0100 Subject: [PATCH] Refactor getOs() Signed-off-by: Kamil Tekiela --- phpstan-baseline.neon | 5 ----- src/Server/SysInfo/SysInfo.php | 5 ++--- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 014ab3d1d9..90796e988f 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -17355,11 +17355,6 @@ parameters: count: 1 path: src/Server/SysInfo/SunOs.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Server/SysInfo/SysInfo.php - - message: "#^Class COM referenced with incorrect case\\: com\\.$#" count: 1 diff --git a/src/Server/SysInfo/SysInfo.php b/src/Server/SysInfo/SysInfo.php index ee30929a4c..ae0e277424 100644 --- a/src/Server/SysInfo/SysInfo.php +++ b/src/Server/SysInfo/SysInfo.php @@ -28,9 +28,8 @@ class SysInfo public static function getOs(string $phpOs = PHP_OS): string { // look for common UNIX-like systems - $unixLike = ['FreeBSD', 'DragonFly']; - if (in_array($phpOs, $unixLike)) { - $phpOs = 'Linux'; + if (in_array($phpOs, ['FreeBSD', 'DragonFly'], true)) { + return 'Linux'; } return ucfirst($phpOs);