8000 bug #30087 [PhpUnitBridge] fix PHP 5.3 compat (nicolas-grekas) · symfony/symfony@5a7bff2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5a7bff2

Browse files
bug #30087 [PhpUnitBridge] fix PHP 5.3 compat (nicolas-grekas)
This PR was merged into the 3.4 branch. Discussion ---------- [PhpUnitBridge] fix PHP 5.3 compat | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - ONLY FOR 3.4 The bridge must remain compatible with PHP 5.3 Introduced in 33a001e. Commits ------- b45cbf6 [PhpUnitBridge] fix PHP 5.3 compat
2 parents 205b0ba + b45cbf6 commit 5a7bff2

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ public static function register($mode = 0)
5454
if (false === $mode) {
5555
$mode = getenv('SYMFONY_DEPRECATIONS_HELPER');
5656
}
57-
if (self::MODE_DISABLED !== $mode
58-
&& self::MODE_WEAK !== $mode
59-
&& self::MODE_WEAK_VENDORS !== $mode
57+
if (DeprecationErrorHandler::MODE_DISABLED !== $mode
58+
&& DeprecationErrorHandler::MODE_WEAK !== $mode
59+
&& DeprecationErrorHandler::MODE_WEAK_VENDORS !== $mode
6060
&& (!isset($mode[0]) || '/' !== $mode[0])
6161
) {
6262
$mode = preg_match('/^[1-9][0-9]*$/', $mode) ? (int) $mode : 0;
@@ -106,15 +106,15 @@ public static function register($mode = 0)
106106
);
107107
$deprecationHandler = function ($type, $msg, $file, $line, $context = array()) use (&$deprecations, $getMode, $UtilPrefix, $inVendors) {
108108
$mode = $getMode();
109-
if ((E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) || self::MODE_DISABLED === $mode) {
109+
if ((E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) || DeprecationErrorHandler::MODE_DISABLED === $mode) {
110110
$ErrorHandler = $UtilPrefix.'ErrorHandler';
111111

112112
return $ErrorHandler::handleError($type, $msg, $file, $line, $context);
113113
}
114114

115115
$trace = debug_backtrace();
116116
$group = 'other';
117-
$isVendor = self::MODE_WEAK_VENDORS === $mode && $inVendors($file);
117+
$isVendor = DeprecationErrorHandler::MODE_WEAK_VENDORS === $mode && $inVendors($file);
118118

119119
$i = \count($trace);
120120
while (1 < $i && (!isset($trace[--$i]['class']) || ('ReflectionMethod' === $trace[$i]['class'] || 0 === strpos($trace[$i]['class'], 'PHPUnit_') || 0 === strpos($trace[$i]['class'], 'PHPUnit\\')))) {
@@ -131,7 +131,7 @@ public static function register($mode = 0)
131131
// \Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerTrait::endTest()
132132
// then we need to use the serialized information to determine
133133
// if the error has been triggered from vendor code.
134-
$isVendor = self::MODE_WEAK_VENDORS === $mode && isset($parsedMsg['triggering_file']) && $inVendors($parsedMsg['triggering_file']);
134+
$isVendor = DeprecationErrorHandler::MODE_WEAK_VENDORS === $mode && isset($parsedMsg['triggering_file']) && $inVendors($parsedMsg['triggering_file']);
135135
} else {
136136
$class = isset($trace[$i]['object']) ? \get_class($trace[$i]['object']) : $trace[$i]['class'];
137137
$method = $trace[$i]['function'];
@@ -168,13 +168,13 @@ public static function register($mode = 0)
168168

169169
exit(1);
170170
}
171-
if ('legacy' !== $group && self::MODE_WEAK !== $mode) {
171+
if ('legacy' !== $group && DeprecationErrorHandler::MODE_WEAK !== $mode) {
172172
$ref = &$deprecations[$group][$msg]['count'];
173173
++$ref;
174174
$ref = &$deprecations[$group][$msg][$class.'::'.$method];
175175
++$ref;
176176
}
177-
} elseif (self::MODE_WEAK !== $mode) {
177+
} elseif (DeprecationErrorHandler::MODE_WEAK !== $mode) {
178178
$ref = &$deprecations[$group][$msg]['count'];
179179
++$ref;
180180
}
@@ -207,7 +207,7 @@ public static function register($mode = 0)
207207
$currErrorHandler = set_error_handler('var_dump');
208208
restore_error_handler();
209209

210-
if (self::MODE_WEAK === $mode) {
210+
if (DeprecationErrorHandler::MODE_WEAK === $mode) {
211211
$colorize = function ($str) { return $str; };
212212
}
213213
if ($currErrorHandler !== $deprecationHandler) {
@@ -219,7 +219,7 @@ public static function register($mode = 0)
219219
};
220220

221221
$groups = array('unsilenced', 'remaining');
222-
if (self::MODE_WEAK_VENDORS === $mode) {
222+
if (DeprecationErrorHandler::MODE_WEAK_VENDORS === $mode) {
223223
$groups[] = 'remaining vendor';
224224
}
225225
array_push($groups, 'legacy', 'other');
@@ -255,7 +255,7 @@ public static function register($mode = 0)
255255
$displayDeprecations($deprecations);
256256

257257
// store failing status
258-
$isFailing = self::MODE_WEAK !== $mode && $mode < $deprecations['unsilencedCount'] + $deprecations['remainingCount'] + $deprecations['otherCount'];
258+
$isFailing = DeprecationErrorHandler::MODE_WEAK !== $mode && $mode < $deprecations['unsilencedCount'] + $deprecations['remainingCount'] + $deprecations['otherCount'];
259259

260260
// reset deprecations array
261261
foreach ($deprecations as $group => $arrayOrInt) {
@@ -270,7 +270,7 @@ public static function register($mode = 0)
270270
}
271271
}
272272
$displayDeprecations($deprecations);
273-
if ($isFailing || self::MODE_WEAK !== $mode && $mode < $deprecations['unsilencedCount'] + $deprecations['remainingCount'] + $deprecations['otherCount']) {
273+
if ($isFailing || DeprecationErrorHandler::MODE_WEAK !== $mode && $mode < $deprecations['unsilencedCount'] + $deprecations['remainingCount'] + $deprecations['otherCount']) {
274274
exit(1);
275275
}
276276
});

src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Test
2525
{
2626
public static function getGroups()
2727
{
28-
return [];
28+
return array();
2929
}
3030
}
3131
EOPHP

src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor/acme/lib/deprecation_riddled.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class Test
77
{
88
public static function getGroups()
99
{
10-
return [];
10+
return array();
1111
}
1212
}
1313
EOPHP

src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/shutdown_deprecations.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Test
2525
{
2626
public static function getGroups()
2727
{
28-
return [];
28+
return array();
2929
}
3030
}
3131
EOPHP

src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_non_vendor.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Test
2525
{
2626
public static function getGroups()
2727
{
28-
return [];
28+
return array();
2929
}
3030
}
3131
EOPHP

0 commit comments

Comments
 (0)
0