Skip to content
Snippets Groups Projects
Commit 28c53bfe authored by David Prévot's avatar David Prévot
Browse files

New upstream version 7.2.0

parents c851a26b 855f3ae0
No related branches found
No related tags found
No related merge requests found
......@@ -31,8 +31,8 @@ jobs:
- name: Run PHP-CS-Fixer
run: ./tools/php-cs-fixer fix --dry-run --show-progress=dots --using-cache=no --verbose
type-checker:
name: Type Checker
static-analysis:
name: Static Analysis
runs-on: ubuntu-latest
......@@ -49,8 +49,8 @@ jobs:
- name: Install dependencies with Composer
run: ./tools/composer update --no-interaction --no-ansi --no-progress
- name: Run Psalm
run: ./tools/psalm --config=.psalm/config.xml --no-progress --shepherd --show-info=false --stats
- name: Run PHPStan
run: ./tools/phpstan analyse --no-progress --error-format=github
tests:
name: Tests
......
......@@ -2,6 +2,5 @@
/.php-cs-fixer.php
/.php-cs-fixer.cache
/.phpunit.cache
/.psalm/cache
/composer.lock
/vendor
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="php-cs-fixer" version="^3.0" installed="3.41.1" location="./tools/php-cs-fixer" copy="true"/>
<phar name="psalm" version="^5.0" installed="5.18.0" location="./tools/psalm" copy="true"/>
<phar name="composer" version="^2.0.3" installed="2.6.6" location="./tools/composer" copy="true"/>
<phar name="php-cs-fixer" version="^3.59" installed="3.59.3" location="./tools/php-cs-fixer" copy="true"/>
<phar name="composer" version="^2.7" installed="2.7.7" location="./tools/composer" copy="true"/>
<phar name="phpstan" version="^1.11" installed="1.11.5" location="./tools/phpstan" copy="true"/>
</phive>
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.9.0@8b9ad1eb9e8b7d3101f949291da2b9f7767cd163">
<file src="src/Console.php">
<ForbiddenCode>
<code><![CDATA[shell_exec('stty size')]]></code>
<code><![CDATA[shell_exec('stty')]]></code>
</ForbiddenCode>
</file>
</files>
<?xml version="1.0"?>
<psalm
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
resolveFromConfigFile="false"
cacheDirectory=".psalm/cache"
checkForThrowsDocblock="true"
findUnusedVariablesAndParams="false"
findUnusedCode="false"
errorBaseline=".psalm/baseline.xml"
findUnusedBaselineEntry="true"
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
</psalm>
......@@ -2,11 +2,13 @@
All notable changes in `sebastianbergmann/environment` are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
## [7.2.0] - 2024-MM-DD
## [7.2.0] - 2024-07-03
### Changed
* Synced `Console::hasColorSupport()` with Symfony's `StreamOutput::hasColorSupport()` implementation
* Removed code left over from a time before PHP 5.4 and when HHVM was still supported
* This project now uses PHPStan instead of Psalm for static analysis
### Deprecated
......@@ -25,6 +27,12 @@ All notable changes in `sebastianbergmann/environment` are documented in this fi
* This component is no longer supported on PHP 8.1
## [6.1.1] - 2024-MM-DD
### Changed
* Synced `Console::hasColorSupport()` with Symfony's `StreamOutput::hasColorSupport()` implementation
## [6.1.0] - 2024-03-23
### Added
......@@ -201,9 +209,10 @@ All notable changes in `sebastianbergmann/environment` are documented in this fi
* This component is no longer supported on PHP 5.6
[7.2.0]: https://github.com/sebastianbergmann/environment/compare/7.1.0...main
[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
[7.0.0]: https://github.com/sebastianbergmann/environment/compare/6.1...7.0.0
[6.1.1]: https://github.com/sebastianbergmann/environment/compare/6.1.0...6.1
[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
......
[![Latest Stable Version](https://poser.pugx.org/sebastian/environment/v/stable.png)](https://packagist.org/packages/sebastian/environment)
[![CI Status](https://github.com/sebastianbergmann/environment/workflows/CI/badge.svg)](https://github.com/sebastianbergmann/environment/actions)
[![Type Coverage](https://shepherd.dev/github/sebastianbergmann/environment/coverage.svg)](https://shepherd.dev/github/sebastianbergmann/environment)
[![codecov](https://codecov.io/gh/sebastianbergmann/environment/branch/main/graph/badge.svg)](https://codecov.io/gh/sebastianbergmann/environment)
# sebastian/environment
......
parameters:
level: 9
paths:
- src
- tests
......@@ -16,7 +16,7 @@
</testsuite>
</testsuites>
<source>
<source ignoreIndirectDeprecations="true" restrictNotices="true" restrictWarnings="true">
<include>
<directory>src</directory>
</include>
......
......@@ -17,6 +17,7 @@ use function fclose;
use function fstat;
use function function_exists;
use function getenv;
use function in_array;
use function is_resource;
use function is_string;
use function posix_isatty;
......@@ -27,6 +28,7 @@ use function sapi_windows_vt100_support;
use function shell_exec;
use function stream_get_contents;
use function stream_isatty;
use function strtoupper;
use function trim;
final class Console
......@@ -54,26 +56,37 @@ final class Console
*/
public function hasColorSupport(): bool
{
if ('Hyper' === getenv('TERM_PROGRAM')) {
if (!defined('STDOUT')) {
return false;
}
if (isset($_SERVER['NO_COLOR']) || false !== getenv('NO_COLOR')) {
return false;
}
if (!@stream_isatty(STDOUT) &&
!in_array(strtoupper((string) getenv('MSYSTEM')), ['MINGW32', 'MINGW64'], true)) {
return false;
}
if ($this->isWindows() &&
function_exists('sapi_windows_vt100_support') &&
@sapi_windows_vt100_support(STDOUT)) {
return true;
}
if ($this->isWindows()) {
// @codeCoverageIgnoreStart
return (defined('STDOUT') && function_exists('sapi_windows_vt100_support') && @sapi_windows_vt100_support(STDOUT)) ||
false !== getenv('ANSICON') ||
'ON' === getenv('ConEmuANSI') ||
'xterm' === getenv('TERM');
// @codeCoverageIgnoreEnd
if ('Hyper' === getenv('TERM_PROGRAM') ||
false !== getenv('COLORTERM') ||
false !== getenv('ANSICON') ||
'ON' === getenv('ConEmuANSI')) {
return true;
}
if (!defined('STDOUT')) {
// @codeCoverageIgnoreStart
if ('dumb' === $term = (string) getenv('TERM')) {
return false;
// @codeCoverageIgnoreEnd
}
return $this->isInteractive(STDOUT);
return (bool) preg_match('/^((screen|xterm|vt100|vt220|putty|rxvt|ansi|cygwin|linux).*)|(.*-256(color)?(-bce)?)$/', $term);
}
/**
......@@ -176,7 +189,7 @@ final class Console
fclose($pipes[2]);
proc_close($process);
if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', (string) $info, $matches)) {
$columns = (int) $matches[2];
}
}
......
......@@ -72,7 +72,7 @@ final class Runtime
return false;
}
$jit = ini_get('opcache.jit');
$jit = (string) ini_get('opcache.jit');
if (($jit === 'disable') || ($jit === 'off')) {
return false;
......@@ -203,7 +203,9 @@ final class Runtime
* where each string has the format `key=value` denoting
* the name of a changed php.ini setting with its new value.
*
* @return string[]
* @param list<string> $values
*
* @return array<string, string>
*/
public function getCurrentSettings(array $values): array
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment