Skip to content

Commit fb3a0ad

Browse files
Merge branch '10.5' into 11.5
2 parents 48f14e3 + b8d0221 commit fb3a0ad

File tree

2 files changed

+52
-42
lines changed

2 files changed

+52
-42
lines changed

ChangeLog-11.5.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes of the PHPUnit 11.5 release series are documented in this fi
44

55
## [11.5.33] - 2025-MM-DD
66

7+
### Changed
8+
9+
* [#6321](https://github.com/sebastianbergmann/phpunit/issues/6321): Allow `error_reporting=E_ALL` for `--check-php-configuration`
10+
711
### Fixed
812

913
* [#5863](https://github.com/sebastianbergmann/phpunit/issues/5863): TestDox printer does not show previous exception

src/TextUI/Command/Commands/CheckPhpConfigurationCommand.php

Lines changed: 48 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
*/
1010
namespace PHPUnit\TextUI\Command;
1111

12+
use const E_ALL;
1213
use const PHP_EOL;
1314
use function extension_loaded;
15+
use function in_array;
1416
use function ini_get;
1517
use function max;
1618
use function sprintf;
@@ -26,46 +28,6 @@
2628
*/
2729
final readonly class CheckPhpConfigurationCommand implements Command
2830
{
29-
/**
30-
* @var non-empty-array<non-empty-string, array{expectedValue: non-empty-string, valueForConfiguration: non-empty-string, requiredExtensions: list<non-empty-string>}>
31-
*/
32-
private const SETTINGS = [
33-
'display_errors' => [
34-
'expectedValue' => '1',
35-
'valueForConfiguration' => 'On',
36-
'requiredExtensions' => [],
37-
],
38-
'display_startup_errors' => [
39-
'expectedValue' => '1',
40-
'valueForConfiguration' => 'On',
41-
'requiredExtensions' => [],
42-
],
43-
'error_reporting' => [
44-
'expectedValue' => '-1',
45-
'valueForConfiguration' => '-1',
46-
'requiredExtensions' => [],
47-
],
48-
'xdebug.show_exception_trace' => [
49-
'expectedValue' => '0',
50-
'valueForConfiguration' => '0',
51-
'requiredExtensions' => ['xdebug'],
52-
],
53-
'zend.assertions' => [
54-
'expectedValue' => '1',
55-
'valueForConfiguration' => '1',
56-
'requiredExtensions' => [],
57-
],
58-
'assert.exception' => [
59-
'expectedValue' => '1',
60-
'valueForConfiguration' => '1',
61-
'requiredExtensions' => [],
62-
],
63-
'memory_limit' => [
64-
'expectedValue' => '-1',
65-
'valueForConfiguration' => '-1',
66-
'requiredExtensions' => [],
67-
],
68-
];
6931
private bool $colorize;
7032

7133
public function __construct()
@@ -78,7 +40,7 @@ public function execute(): Result
7840
$lines = [];
7941
$shellExitCode = 0;
8042

81-
foreach (self::SETTINGS as $name => $setting) {
43+
foreach ($this->settings() as $name => $setting) {
8244
foreach ($setting['requiredExtensions'] as $extension) {
8345
if (!extension_loaded($extension)) {
8446
// @codeCoverageIgnoreStart
@@ -89,7 +51,7 @@ public function execute(): Result
8951

9052
$actualValue = ini_get($name);
9153

92-
if ($actualValue === $setting['expectedValue']) {
54+
if (in_array($actualValue, $setting['expectedValues'], true)) {
9355
$check = $this->ok();
9456
} else {
9557
$check = $this->notOk($actualValue);
@@ -157,4 +119,48 @@ private function notOk(string $actualValue): string
157119
return Color::colorizeTextBox('fg-red, bold', $message);
158120
// @codeCoverageIgnoreEnd
159121
}
122+
123+
/**
124+
* @return non-empty-array<non-empty-string, array{expectedValues: non-empty-list<non-empty-string>, valueForConfiguration: non-empty-string, requiredExtensions: list<non-empty-string>}>
125+
*/
126+
private function settings(): array
127+
{
128+
return [
129+
'display_errors' => [
130+
'expectedValues' => ['1'],
131+
'valueForConfiguration' => 'On',
132+
'requiredExtensions' => [],
133+
],
134+
'display_startup_errors' => [
135+
'expectedValues' => ['1'],
136+
'valueForConfiguration' => 'On',
137+
'requiredExtensions' => [],
138+
],
139+
'error_reporting' => [
140+
'expectedValues' => ['-1', (string) E_ALL],
141+
'valueForConfiguration' => '-1',
142+
'requiredExtensions' => [],
143+
],
144+
'xdebug.show_exception_trace' => [
145+
'expectedValues' => ['0'],
146+
'valueForConfiguration' => '0',
147+
'requiredExtensions' => ['xdebug'],
148+
],
149+
'zend.assertions' => [
150+
'expectedValues' => ['1'],
151+
'valueForConfiguration' => '1',
152+
'requiredExtensions' => [],
153+
],
154+
'assert.exception' => [
155+
'expectedValues' => ['1'],
156+
'valueForConfiguration' => '1',
157+
'requiredExtensions' => [],
158+
],
159+
'memory_limit' => [
160+
'expectedValues' => ['-1'],
161+
'valueForConfiguration' => '-1',
162+
'requiredExtensions' => [],
163+
],
164+
];
165+
}
160166
}

0 commit comments

Comments
 (0)