Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Console][PhpUnitBridge][VarDumper] Fix NO_COLOR empty value handling #57815

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
private $configuration;

/**
* @var DeprecationGroup[]

Check failure on line 39 in src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

View workflow job for this annotation

GitHub Actions / Psalm

UndefinedDocblockClass

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php:39:13: UndefinedDocblockClass: Docblock-defined class, interface or enum named Symfony\Bridge\PhpUnit\DeprecationErrorHandler\DeprecationGroup does not exist (see https://psalm.dev/200)

Check failure on line 39 in src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

View workflow job for this annotation

GitHub Actions / Psalm

UndefinedDocblockClass

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php:39:13: UndefinedDocblockClass: Docblock-defined class, interface or enum named Symfony\Bridge\PhpUnit\DeprecationErrorHandler\DeprecationGroup does not exist (see https://psalm.dev/200)
*/
private $deprecationGroups = [];

Check failure on line 41 in src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

View workflow job for this annotation

GitHub Actions / Psalm

UndefinedDocblockClass

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php:41:5: UndefinedDocblockClass: Docblock-defined class, interface or enum named Symfony\Bridge\PhpUnit\DeprecationErrorHandler\DeprecationGroup does not exist (see https://psalm.dev/200)

Check failure on line 41 in src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

View workflow job for this annotation

GitHub Actions / Psalm

UndefinedDocblockClass

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php:41:5: UndefinedDocblockClass: Docblock-defined class, interface or enum named Symfony\Bridge\PhpUnit\DeprecationErrorHandler\DeprecationGroup does not exist (see https://psalm.dev/200)

private static $isRegistered = false;
private static $errorHandler;
Expand Down Expand Up @@ -235,12 +235,12 @@
private function resetDeprecationGroups()
{
$this->deprecationGroups = [
'unsilenced' => new DeprecationGroup(),

Check failure on line 238 in src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

View workflow job for this annotation

GitHub Actions / Psalm

UndefinedClass

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php:238:33: UndefinedClass: Class, interface or enum named Symfony\Bridge\PhpUnit\DeprecationErrorHandler\DeprecationGroup does not exist (see https://psalm.dev/019)
'self' => new DeprecationGroup(),

Check failure on line 239 in src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

View workflow job for this annotation

GitHub Actions / Psalm

UndefinedClass

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php:239:27: UndefinedClass: Class, interface or enum named Symfony\Bridge\PhpUnit\DeprecationErrorHandler\DeprecationGroup does not exist (see https://psalm.dev/019)
'direct' => new DeprecationGroup(),

Check failure on line 240 in src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

View workflow job for this annotation

GitHub Actions / Psalm

UndefinedClass

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php:240:29: UndefinedClass: Class, interface or enum named Symfony\Bridge\PhpUnit\DeprecationErrorHandler\DeprecationGroup does not exist (see https://psalm.dev/019)
'indirect' => new DeprecationGroup(),

Check failure on line 241 in src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

View workflow job for this annotation

GitHub Actions / Psalm

UndefinedClass

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php:241:31: UndefinedClass: Class, interface or enum named Symfony\Bridge\PhpUnit\DeprecationErrorHandler\DeprecationGroup does not exist (see https://psalm.dev/019)
'legacy' => new DeprecationGroup(),

Check failure on line 242 in src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

View workflow job for this annotation

GitHub Actions / Psalm

UndefinedClass

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php:242:29: UndefinedClass: Class, interface or enum named Symfony\Bridge\PhpUnit\DeprecationErrorHandler\DeprecationGroup does not exist (see https://psalm.dev/019)
'other' => new DeprecationGroup(),

Check failure on line 243 in src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

View workflow job for this annotation

GitHub Actions / Psalm

UndefinedClass

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php:243:28: UndefinedClass: Class, interface or enum named Symfony\Bridge\PhpUnit\DeprecationErrorHandler\DeprecationGroup does not exist (see https://psalm.dev/019)
];
}

Expand Down Expand Up @@ -410,7 +410,7 @@
}

// Follow https://no-color.org/
if (isset($_SERVER['NO_COLOR']) || false !== getenv('NO_COLOR')) {
if ('' !== ($_SERVER['NO_COLOR'] ?? getenv('NO_COLOR') ?: '')) {
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ class_exists(\SymfonyExcludeListSimplePhpunit::class, false) && PHPUnit\Util\Bla
}
}

$cmd[0] = sprintf('%s %s --colors=%s', $PHP, escapeshellarg("$PHPUNIT_DIR/$PHPUNIT_VERSION_DIR/phpunit"), false === $getEnvVar('NO_COLOR') ? 'always' : 'never');
$cmd[0] = sprintf('%s %s --colors=%s', $PHP, escapeshellarg("$PHPUNIT_DIR/$PHPUNIT_VERSION_DIR/phpunit"), '' === $getEnvVar('NO_COLOR', '') ? 'always' : 'never');
$cmd = str_replace('%', '%%', implode(' ', $cmd)).' %1$s';

if ('\\' === \DIRECTORY_SEPARATOR) {
Expand Down Expand Up @@ -458,7 +458,7 @@ class SymfonyExcludeListSimplePhpunit
{
}
}
array_splice($argv, 1, 0, ['--colors='.(false === $getEnvVar('NO_COLOR') ? 'always' : 'never')]);
array_splice($argv, 1, 0, ['--colors='.('' === $getEnvVar('NO_COLOR', '') ? 'always' : 'never')]);
$_SERVER['argv'] = $argv;
$_SERVER['argc'] = ++$argc;
include "$PHPUNIT_DIR/$PHPUNIT_VERSION_DIR/phpunit";
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Console/Output/StreamOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ protected function doWrite(string $message, bool $newline)
protected function hasColorSupport()
{
// Follow https://no-color.org/
if (isset($_SERVER['NO_COLOR']) || false !== getenv('NO_COLOR')) {
if ('' !== ($_SERVER['NO_COLOR'] ?? getenv('NO_COLOR') ?: '')) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/VarDumper/Dumper/CliDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ private function hasColorSupport($stream): bool
}

// Follow https://no-color.org/
if (isset($_SERVER['NO_COLOR']) || false !== getenv('NO_COLOR')) {
if ('' !== ($_SERVER['NO_COLOR'] ?? getenv('NO_COLOR') ?: '')) {
return false;
}

Expand Down
Loading