Skip to content

Commit

Permalink
Use PHP_OS_FAMILY when possible.
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <[email protected]>
  • Loading branch information
crynobone committed May 3, 2020
1 parent ce3a57b commit 4a58eb8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/OperatingSystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand All @@ -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';
}
}

0 comments on commit 4a58eb8

Please sign in to comment.