🔧
This commit is contained in:
6
vendor/sebastian/environment/src/Console.php
vendored
6
vendor/sebastian/environment/src/Console.php
vendored
@@ -97,7 +97,7 @@ final class Console
|
||||
/**
|
||||
* Returns if the file descriptor is an interactive terminal or not.
|
||||
*
|
||||
* Normally, we want to use a resource as a parameter, yet sadly it's not always awailable,
|
||||
* Normally, we want to use a resource as a parameter, yet sadly it's not always available,
|
||||
* eg when running code in interactive console (`php -a`), STDIN/STDOUT/STDERR constants are not defined.
|
||||
*
|
||||
* @param int|resource $fileDescriptor
|
||||
@@ -112,7 +112,7 @@ final class Console
|
||||
if (function_exists('fstat')) {
|
||||
$stat = @fstat(STDOUT);
|
||||
|
||||
return $stat && 0020000 === ($stat['mode'] & 0170000);
|
||||
return $stat && 0o020000 === ($stat['mode'] & 0o170000);
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -166,7 +166,7 @@ final class Console
|
||||
$pipes,
|
||||
null,
|
||||
null,
|
||||
['suppress_errors' => true]
|
||||
['suppress_errors' => true],
|
||||
);
|
||||
|
||||
if (is_resource($process)) {
|
||||
|
||||
39
vendor/sebastian/environment/src/Runtime.php
vendored
39
vendor/sebastian/environment/src/Runtime.php
vendored
@@ -30,7 +30,7 @@ use function strrpos;
|
||||
|
||||
final class Runtime
|
||||
{
|
||||
private static string $binary;
|
||||
private static string $rawBinary;
|
||||
private static bool $initialized = false;
|
||||
|
||||
/**
|
||||
@@ -91,19 +91,19 @@ final class Runtime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the path to the binary of the current runtime.
|
||||
* Returns the raw path to the binary of the current runtime.
|
||||
*/
|
||||
public function getBinary(): string
|
||||
public function getRawBinary(): string
|
||||
{
|
||||
if (self::$initialized) {
|
||||
return self::$binary;
|
||||
return self::$rawBinary;
|
||||
}
|
||||
|
||||
if (PHP_BINARY !== '') {
|
||||
self::$binary = escapeshellarg(PHP_BINARY);
|
||||
self::$rawBinary = PHP_BINARY;
|
||||
self::$initialized = true;
|
||||
|
||||
return self::$binary;
|
||||
return self::$rawBinary;
|
||||
}
|
||||
|
||||
// @codeCoverageIgnoreStart
|
||||
@@ -115,19 +115,26 @@ final class Runtime
|
||||
|
||||
foreach ($possibleBinaryLocations as $binary) {
|
||||
if (is_readable($binary)) {
|
||||
self::$binary = escapeshellarg($binary);
|
||||
self::$rawBinary = $binary;
|
||||
self::$initialized = true;
|
||||
|
||||
return self::$binary;
|
||||
return self::$rawBinary;
|
||||
}
|
||||
}
|
||||
|
||||
// @codeCoverageIgnoreStart
|
||||
self::$binary = 'php';
|
||||
self::$rawBinary = 'php';
|
||||
self::$initialized = true;
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
return self::$binary;
|
||||
return self::$rawBinary;
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the escaped path to the binary of the current runtime.
|
||||
*/
|
||||
public function getBinary(): string
|
||||
{
|
||||
return escapeshellarg($this->getRawBinary());
|
||||
}
|
||||
|
||||
public function getNameWithVersion(): string
|
||||
@@ -141,7 +148,7 @@ final class Runtime
|
||||
return sprintf(
|
||||
'%s with PCOV %s',
|
||||
$this->getNameWithVersion(),
|
||||
phpversion('pcov')
|
||||
phpversion('pcov'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -149,7 +156,7 @@ final class Runtime
|
||||
return sprintf(
|
||||
'%s with Xdebug %s',
|
||||
$this->getNameWithVersion(),
|
||||
phpversion('xdebug')
|
||||
phpversion('xdebug'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -244,8 +251,8 @@ final class Runtime
|
||||
$files,
|
||||
array_map(
|
||||
'trim',
|
||||
explode(",\n", $scanned)
|
||||
)
|
||||
explode(",\n", $scanned),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user