fix:repo cleanup
This commit is contained in:
+28
@@ -2,6 +2,30 @@
|
||||
|
||||
All notable changes in `sebastianbergmann/environment` are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
|
||||
|
||||
## [8.0.3] - 2025-08-12
|
||||
|
||||
### Changed
|
||||
|
||||
* [#75](https://github.com/sebastianbergmann/environment/pull/75): Make `Runtime::isOpcacheActive()` public
|
||||
|
||||
## [8.0.2] - 2025-05-21
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#74](https://github.com/sebastianbergmann/environment/pull/74): Regression introduced in version 8.0.0
|
||||
|
||||
## [8.0.1] - 2025-05-21
|
||||
|
||||
### Fixed
|
||||
|
||||
* Take Xdebug mode into account for `Runtime::canCollectCodeCoverage()`
|
||||
|
||||
## [8.0.0] - 2025-02-07
|
||||
|
||||
### Removed
|
||||
|
||||
* This component is no longer supported on PHP 8.2
|
||||
|
||||
## [7.2.1] - 2025-05-21
|
||||
|
||||
### Fixed
|
||||
@@ -215,6 +239,10 @@ All notable changes in `sebastianbergmann/environment` are documented in this fi
|
||||
|
||||
* This component is no longer supported on PHP 5.6
|
||||
|
||||
[8.0.3]: https://github.com/sebastianbergmann/environment/compare/8.0.2...8.0.3
|
||||
[8.0.2]: https://github.com/sebastianbergmann/environment/compare/8.0.1...8.0.2
|
||||
[8.0.1]: https://github.com/sebastianbergmann/environment/compare/8.0.0...8.0.1
|
||||
[8.0.0]: https://github.com/sebastianbergmann/environment/compare/7.2...8.0.0
|
||||
[7.2.1]: https://github.com/sebastianbergmann/environment/compare/7.2.0...7.2.1
|
||||
[7.2.0]: https://github.com/sebastianbergmann/environment/compare/7.1.0...7.2.0
|
||||
[7.1.0]: https://github.com/sebastianbergmann/environment/compare/7.0.0...7.1.0
|
||||
|
||||
+4
-4
@@ -16,17 +16,17 @@
|
||||
},
|
||||
"config": {
|
||||
"platform": {
|
||||
"php": "8.2.0"
|
||||
"php": "8.3.0"
|
||||
},
|
||||
"optimize-autoloader": true,
|
||||
"sort-packages": true
|
||||
},
|
||||
"prefer-stable": true,
|
||||
"require": {
|
||||
"php": ">=8.2"
|
||||
"php": ">=8.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^11.3"
|
||||
"phpunit/phpunit": "^12.0"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-posix": "*"
|
||||
@@ -38,7 +38,7 @@
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "7.2-dev"
|
||||
"dev-main": "8.0-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+32
-13
@@ -20,6 +20,7 @@ use function function_exists;
|
||||
use function getenv;
|
||||
use function in_array;
|
||||
use function is_array;
|
||||
use function is_int;
|
||||
use function is_resource;
|
||||
use function is_string;
|
||||
use function posix_isatty;
|
||||
@@ -38,17 +39,17 @@ final class Console
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public const STDIN = 0;
|
||||
public const int STDIN = 0;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public const STDOUT = 1;
|
||||
public const int STDOUT = 1;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public const STDERR = 2;
|
||||
public const int STDERR = 2;
|
||||
|
||||
/**
|
||||
* Returns true if STDOUT supports colorization.
|
||||
@@ -117,8 +118,10 @@ final class Console
|
||||
*
|
||||
* @param int|resource $fileDescriptor
|
||||
*/
|
||||
public function isInteractive($fileDescriptor = self::STDOUT): bool
|
||||
public function isInteractive(mixed $fileDescriptor = self::STDOUT): bool
|
||||
{
|
||||
assert(is_int($fileDescriptor) || is_resource($fileDescriptor));
|
||||
|
||||
if (is_resource($fileDescriptor)) {
|
||||
if (function_exists('stream_isatty') && @stream_isatty($fileDescriptor)) {
|
||||
return true;
|
||||
@@ -127,7 +130,7 @@ final class Console
|
||||
if (function_exists('fstat')) {
|
||||
$stat = @fstat(STDOUT);
|
||||
|
||||
return $stat && 0o020000 === ($stat['mode'] & 0o170000);
|
||||
return $stat !== false && 0o020000 === ($stat['mode'] & 0o170000);
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -146,15 +149,29 @@ final class Console
|
||||
*/
|
||||
private function getNumberOfColumnsInteractive(): int
|
||||
{
|
||||
if (function_exists('shell_exec') && preg_match('#\d+ (\d+)#', shell_exec('stty size') ?: '', $match) === 1) {
|
||||
if ((int) $match[1] > 0) {
|
||||
return (int) $match[1];
|
||||
}
|
||||
}
|
||||
if (function_exists('shell_exec')) {
|
||||
$stty = shell_exec('stty size');
|
||||
|
||||
if (function_exists('shell_exec') && preg_match('#columns = (\d+);#', shell_exec('stty') ?: '', $match) === 1) {
|
||||
if ((int) $match[1] > 0) {
|
||||
return (int) $match[1];
|
||||
if ($stty === false || $stty === null) {
|
||||
$stty = '';
|
||||
}
|
||||
|
||||
if (preg_match('#\d+ (\d+)#', $stty, $match) === 1) {
|
||||
if ((int) $match[1] > 0) {
|
||||
return (int) $match[1];
|
||||
}
|
||||
}
|
||||
|
||||
$stty = shell_exec('stty');
|
||||
|
||||
if ($stty === false || $stty === null) {
|
||||
$stty = '';
|
||||
}
|
||||
|
||||
if (preg_match('#columns = (\d+);#', $stty, $match) === 1) {
|
||||
if ((int) $match[1] > 0) {
|
||||
return (int) $match[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,6 +186,7 @@ final class Console
|
||||
$ansicon = getenv('ANSICON');
|
||||
$columns = 80;
|
||||
|
||||
/** @phpstan-ignore booleanAnd.rightNotBoolean */
|
||||
if (is_string($ansicon) && preg_match('/^(\d+)x\d+ \(\d+x(\d+)\)$/', trim($ansicon), $matches)) {
|
||||
$columns = (int) $matches[1];
|
||||
} elseif (function_exists('proc_open')) {
|
||||
@@ -195,6 +213,7 @@ final class Console
|
||||
fclose($pipes[2]);
|
||||
proc_close($process);
|
||||
|
||||
/** @phpstan-ignore if.condNotBoolean */
|
||||
if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', (string) $info, $matches)) {
|
||||
$columns = (int) $matches[2];
|
||||
}
|
||||
|
||||
+9
-5
@@ -218,7 +218,7 @@ final class Runtime
|
||||
*/
|
||||
public function hasPCOV(): bool
|
||||
{
|
||||
return $this->isPHP() && extension_loaded('pcov') && ini_get('pcov.enabled');
|
||||
return $this->isPHP() && extension_loaded('pcov') && ini_get('pcov.enabled') === '1';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -240,11 +240,15 @@ final class Runtime
|
||||
$diff = [];
|
||||
$files = [];
|
||||
|
||||
if ($file = php_ini_loaded_file()) {
|
||||
$file = php_ini_loaded_file();
|
||||
|
||||
if ($file !== false) {
|
||||
$files[] = $file;
|
||||
}
|
||||
|
||||
if ($scanned = php_ini_scanned_files()) {
|
||||
$scanned = php_ini_scanned_files();
|
||||
|
||||
if ($scanned !== false) {
|
||||
$files = array_merge(
|
||||
$files,
|
||||
array_map(
|
||||
@@ -260,7 +264,7 @@ final class Runtime
|
||||
foreach ($values as $value) {
|
||||
$set = ini_get($value);
|
||||
|
||||
if (empty($set)) {
|
||||
if ($set === false || $set === '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -273,7 +277,7 @@ final class Runtime
|
||||
return $diff;
|
||||
}
|
||||
|
||||
private function isOpcacheActive(): bool
|
||||
public function isOpcacheActive(): bool
|
||||
{
|
||||
if (!extension_loaded('Zend OPcache')) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user