Skip to content

Commit b11585e

Browse files
[PhpUnitBridge] fixes
1 parent a36fbe3 commit b11585e

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,10 @@ private function getConfiguration()
227227
return $this->configuration = Configuration::inWeakMode();
228228
}
229229
if (self::MODE_WEAK_VENDORS === $mode) {
230-
echo sprintf('Setting SYMFONY_DEPRECATIONS_HELPER to "%s" is deprecated in favor of "max[self]=0"', $mode).PHP_EOL;
231-
exit(1);
230+
++$this->deprecations['remaining selfCount'];
231+
$msg = sprintf('Setting SYMFONY_DEPRECATIONS_HELPER to "%s" is deprecated in favor of "max[self]=0"', $mode);
232+
$ref = &$this->deprecations['remaining self'][$msg]['count'];
233+
++$ref;
232234
}
233235
if (isset($mode[0]) && '/' === $mode[0]) {
234236
return $this->configuration = Configuration::fromRegex($mode);

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Configuration.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
*/
1717
class Configuration
1818
{
19-
const GROUPS = ['total', 'indirect', 'direct', 'self'];
20-
2119
/**
2220
* @var int[]
2321
*/
@@ -46,9 +44,11 @@ class Configuration
4644
*/
4745
private function __construct(array $thresholds = [], $regex = '', $verboseOutput = true)
4846
{
47+
$groups = ['total', 'indirect', 'direct', 'self'];
48+
4949
foreach ($thresholds as $group => $threshold) {
50-
if (!\in_array($group, self::GROUPS, true)) {
51-
throw new \InvalidArgumentException(sprintf('Unrecognized threshold "%s", expected one of "%s"', $group, implode('", "', self::GROUPS)));
50+
if (!\in_array($group, $groups, true)) {
51+
throw new \InvalidArgumentException(sprintf('Unrecognized threshold "%s", expected one of "%s"', $group, implode('", "', $groups)));
5252
}
5353
if (!is_numeric($threshold)) {
5454
throw new \InvalidArgumentException(sprintf('Threshold for group "%s" has invalid value "%s"', $group, $threshold));
@@ -66,7 +66,7 @@ private function __construct(array $thresholds = [], $regex = '', $verboseOutput
6666
'self' => $this->thresholds['indirect'],
6767
];
6868
}
69-
foreach (self::GROUPS as $group) {
69+
foreach ($groups as $group) {
7070
if (!isset($this->thresholds[$group])) {
7171
$this->thresholds[$group] = 999999;
7272
}

0 commit comments

Comments
 (0)