Skip to content

Commit 45d21d9

Browse files
MacDadasebastianbergmann
authored andcommitted
Improve output of --check-php-configuration
Showing the actual configuration value if the value is not as expected. Resolves #6307
1 parent 49ca3ec commit 45d21d9

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

src/TextUI/Command/Commands/CheckPhpConfigurationCommand.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,12 @@ public function execute(): Result
8787
}
8888
}
8989

90-
if (ini_get($name) === $setting['expectedValue']) {
90+
$actualValue = ini_get($name);
91+
92+
if ($actualValue === $setting['expectedValue']) {
9193
$check = $this->ok();
9294
} else {
93-
$check = $this->notOk();
95+
$check = $this->notOk($actualValue);
9496
$shellExitCode = 1;
9597
}
9698

@@ -143,14 +145,16 @@ private function ok(): string
143145
/**
144146
* @return non-empty-string
145147
*/
146-
private function notOk(): string
148+
private function notOk(string $actualValue): string
147149
{
150+
$message = sprintf('not ok (%s)', $actualValue);
151+
148152
if (!$this->colorize) {
149-
return 'not ok';
153+
return $message;
150154
}
151155

152156
// @codeCoverageIgnoreStart
153-
return Color::colorizeTextBox('fg-red, bold', 'not ok');
157+
return Color::colorizeTextBox('fg-red, bold', $message);
154158
// @codeCoverageIgnoreEnd
155159
}
156160
}

tests/end-to-end/check-php-configuration/failure-with-xdebug.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ PHPUnit %s by Sebastian Bergmann and contributors.
2626

2727
Checking whether PHP is configured according to https://docs.phpunit.de/en/%s/installation.html#configuring-php-for-development
2828

29-
display_errors = On ... not ok
29+
display_errors = On ... not ok (0)
3030
display_startup_errors = On ... ok
3131
error_reporting = -1 ... ok
3232
xdebug.show_exception_trace = 0 ... ok

tests/end-to-end/check-php-configuration/failure-without-xdebug.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ PHPUnit %s by Sebastian Bergmann and contributors.
2525

2626
Checking whether PHP is configured according to https://docs.phpunit.de/en/%s/installation.html#configuring-php-for-development
2727

28-
display_errors = On ... not ok
28+
display_errors = On ... not ok (0)
2929
display_startup_errors = On ... ok
3030
error_reporting = -1 ... ok
3131
zend.assertions = 1 ... ok

0 commit comments

Comments
 (0)