🔧
This commit is contained in:
7
vendor/sebastian/environment/ChangeLog.md
vendored
7
vendor/sebastian/environment/ChangeLog.md
vendored
@@ -2,6 +2,12 @@
|
||||
|
||||
All notable changes in `sebastianbergmann/environment` are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
|
||||
|
||||
## [6.1.0] - 2024-03-23
|
||||
|
||||
### Added
|
||||
|
||||
* [#72](https://github.com/sebastianbergmann/environment/pull/72): `Runtime::getRawBinary()`
|
||||
|
||||
## [6.0.1] - 2023-04-11
|
||||
|
||||
### Fixed
|
||||
@@ -172,6 +178,7 @@ All notable changes in `sebastianbergmann/environment` are documented in this fi
|
||||
|
||||
* This component is no longer supported on PHP 5.6
|
||||
|
||||
[6.1.0]: https://github.com/sebastianbergmann/environment/compare/6.0.1...6.1.0
|
||||
[6.0.1]: https://github.com/sebastianbergmann/environment/compare/6.0.0...6.0.1
|
||||
[6.0.0]: https://github.com/sebastianbergmann/environment/compare/5.1.5...6.0.0
|
||||
[5.1.5]: https://github.com/sebastianbergmann/environment/compare/5.1.4...5.1.5
|
||||
|
||||
2
vendor/sebastian/environment/LICENSE
vendored
2
vendor/sebastian/environment/LICENSE
vendored
@@ -1,6 +1,6 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2014-2023, Sebastian Bergmann
|
||||
Copyright (c) 2014-2024, Sebastian Bergmann
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
2
vendor/sebastian/environment/composer.json
vendored
2
vendor/sebastian/environment/composer.json
vendored
@@ -38,7 +38,7 @@
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "6.0-dev"
|
||||
"dev-main": "6.1-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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