Simplify Windows checking (#141)

See https://www.php.net/manual/en/reserved.constants.php#constant.php-os-family
This commit is contained in:
Gemorroj 2021-12-01 10:26:41 +03:00 committed by GitHub
parent 8b048caa71
commit 7fde6f1308
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -33,7 +33,7 @@ class ProcessHub
public function __construct()
{
$isWindows = \strncasecmp(\PHP_OS, "WIN", 3) === 0;
$isWindows = \PHP_OS_FAMILY === 'Windows';
if ($isWindows) {
$this->uri = "tcp://127.0.0.1:0";

View File

@ -143,7 +143,7 @@ final class Process implements Context
private static function locateBinary(): string
{
$executable = \strncasecmp(\PHP_OS, "WIN", 3) === 0 ? "php.exe" : "php";
$executable = \PHP_OS_FAMILY === 'Windows' ? "php.exe" : "php";
$paths = \array_filter(\explode(\PATH_SEPARATOR, \getenv("PATH")));
$paths[] = \PHP_BINDIR;