This commit is contained in:
2025-05-12 14:25:25 +02:00
parent ab2db755ef
commit 9e378ca2b7
2719 changed files with 46505 additions and 60181 deletions

View File

@@ -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)) {

View File

@@ -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),
),
);
}