From 4a58eb83ad6741dd5ca42b56d0bd6fe9e381ecce Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Mon, 4 May 2020 00:41:22 +0800 Subject: [PATCH] Use PHP_OS_FAMILY when possible. Signed-off-by: Mior Muhammad Zaki --- src/OperatingSystem.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/OperatingSystem.php b/src/OperatingSystem.php index 910239c..3433450 100644 --- a/src/OperatingSystem.php +++ b/src/OperatingSystem.php @@ -21,7 +21,11 @@ public static function id() */ public static function onWindows() { - return PHP_OS === 'WINNT' || mb_strpos(\php_uname(), 'Microsoft') !== false; + if (\defined('PHP_OS_FAMILY')) { + return PHP_OS_FAMILY === 'Windows'; + } + + return PHP_OS === 'WINNT' || \mb_strpos(\php_uname(), 'Microsoft') !== false; } /** @@ -31,6 +35,10 @@ public static function onWindows() */ public static function onMac() { + if (\defined('PHP_OS_FAMILY')) { + return PHP_OS_FAMILY === 'Darwin'; + } + return PHP_OS === 'Darwin'; } }