@@ -32,10 +32,10 @@ class SymfonyTestsListenerTrait
32
32
private static $ globallyEnabled = false ;
33
33
private $ state = -1 ;
34
34
private $ skippedFile = false ;
35
- private $ wasSkipped = [] ;
36
- private $ isSkipped = [] ;
37
- private $ expectedDeprecations = [] ;
38
- private $ gatheredDeprecations = [] ;
35
+ private $ wasSkipped = array () ;
36
+ private $ isSkipped = array () ;
37
+ private $ expectedDeprecations = array () ;
38
+ private $ gatheredDeprecations = array () ;
39
39
private $ previousErrorHandler ;
40
40
private $ testsWithWarnings ;
41
41
private $ reportUselessTests ;
@@ -45,7 +45,7 @@ class SymfonyTestsListenerTrait
45
45
/**
46
46
* @param array $mockedNamespaces List of namespaces, indexed by mocked features (time-sensitive or dns-sensitive)
47
47
*/
48
- public function __construct (array $ mockedNamespaces = [] )
48
+ public function __construct (array $ mockedNamespaces = array () )
49
49
{
50
50
if (class_exists ('PHPUnit_Util_Blacklist ' )) {
51
51
\PHPUnit_Util_Blacklist::$ blacklistedClassNames ['\Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerTrait ' ] = 2 ;
@@ -57,7 +57,7 @@ public function __construct(array $mockedNamespaces = [])
57
57
58
58
foreach ($ mockedNamespaces as $ type => $ namespaces ) {
59
59
if (!\is_array ($ namespaces )) {
60
- $ namespaces = [ $ namespaces] ;
60
+ $ namespaces = array ( $ namespaces) ;
61
61
}
62
62
if ('time-sensitive ' === $ type ) {
63
63
foreach ($ namespaces as $ ns ) {
@@ -104,7 +104,7 @@ public function startTestSuite($suite)
104
104
$ Test = 'PHPUnit\Util\Test ' ;
105
105
}
106
106
$ suiteName = $ suite ->getName ();
107
- $ this ->testsWithWarnings = [] ;
107
+ $ this ->testsWithWarnings = array () ;
108
108
109
109
foreach ($ suite ->tests () as $ test ) {
110
110
if (!($ test instanceof \PHPUnit \Framework \TestCase || $ test instanceof TestCase)) {
@@ -135,11 +135,11 @@ public function startTestSuite($suite)
135
135
136
136
if (!$ this ->wasSkipped = require $ this ->skippedFile ) {
137
137
echo "All tests already ran successfully. \n" ;
138
- $ suite ->setTests ([] );
138
+ $ suite ->setTests (array () );
139
139
}
140
140
}
141
141
}
142
- $ testSuites = [ $ suite] ;
142
+ $ testSuites = array ( $ suite) ;
143
143
for ($ i = 0 ; isset ($ testSuites [$ i ]); ++$ i ) {
144
144
foreach ($ testSuites [$ i ]->tests () as $ test ) {
145
145
if ($ test instanceof \PHPUnit_Framework_TestSuite || $ test instanceof TestSuite) {
@@ -158,7 +158,7 @@ public function startTestSuite($suite)
158
158
}
159
159
}
160
160
} elseif (2 === $ this ->state ) {
161
- $ skipped = [] ;
161
+ $ skipped = array () ;
162
162
foreach ($ suite ->tests () as $ test ) {
163
163
if (!($ test instanceof \PHPUnit \Framework \TestCase || $ test instanceof TestCase)
164
164
|| isset ($ this ->wasSkipped [$ suiteName ]['* ' ])
@@ -230,7 +230,7 @@ public function startTest($test)
230
230
$ test ->getTestResultObject ()->beStrictAboutTestsThatDoNotTestAnything (false );
231
231
232
232
$ this ->expectedDeprecations = $ annotations ['method ' ]['expectedDeprecation ' ];
233
- $ this ->previousErrorHandler = set_error_handler ([ $ this , 'handleError ' ] );
233
+ $ this ->previousErrorHandler = set_error_handler (array ( $ this , 'handleError ' ) );
234
234
}
235
235
}
236
236
}
@@ -271,8 +271,8 @@ public function endTest($test, $time)
271
271
$ deprecations = file_get_contents ($ this ->runsInSeparateProcess );
272
272
unlink ($ this ->runsInSeparateProcess );
273
273
putenv ('SYMFONY_DEPRECATIONS_SERIALIZE ' );
274
- foreach ($ deprecations ? unserialize ($ deprecations ) : [] as $ deprecation ) {
275
- $ error = serialize ([ 'deprecation ' => $ deprecation [1 ], 'class ' => $ className , 'method ' => $ test ->getName (false ), 'triggering_file ' => isset ($ deprecation [2 ]) ? $ deprecation [2 ] : null ] );
274
+ foreach ($ deprecations ? unserialize ($ deprecations ) : array () as $ deprecation ) {
275
+ $ error = serialize (array ( 'deprecation ' => $ deprecation [1 ], 'class ' => $ className , 'method ' => $ test ->getName (false ), 'triggering_file ' => isset ($ deprecation [2 ]) ? $ deprecation [2 ] : null ) );
276
276
if ($ deprecation [0 ]) {
277
277
@trigger_error ($ error , E_USER_DEPRECATED );
278
278
} else {
@@ -283,13 +283,13 @@ public function endTest($test, $time)
283
283
}
284
284
285
285
if ($ this ->expectedDeprecations ) {
286
- if (!\in_array ($ test ->getStatus (), [ $ BaseTestRunner ::STATUS_SKIPPED , $ BaseTestRunner ::STATUS_INCOMPLETE ] , true )) {
286
+ if (!\in_array ($ test ->getStatus (), array ( $ BaseTestRunner ::STATUS_SKIPPED , $ BaseTestRunner ::STATUS_INCOMPLETE ) , true )) {
287
287
$ test ->addToAssertionCount (\count ($ this ->expectedDeprecations ));
288
288
}
289
289
290
290
restore_error_handler ();
291
291
292
- if (!$ errored && !\in_array ($ test ->getStatus (), [ $ BaseTestRunner ::STATUS_SKIPPED , $ BaseTestRunner ::STATUS_INCOMPLETE , $ BaseTestRunner ::STATUS_FAILURE , $ BaseTestRunner ::STATUS_ERROR ] , true )) {
292
+ if (!$ errored && !\in_array ($ test ->getStatus (), array ( $ BaseTestRunner ::STATUS_SKIPPED , $ BaseTestRunner ::STATUS_INCOMPLETE , $ BaseTestRunner ::STATUS_FAILURE , $ BaseTestRunner ::STATUS_ERROR ) , true )) {
293
293
try {
294
294
$ prefix = "@expectedDeprecation: \n" ;
295
295
$ test ->assertStringMatchesFormat ($ prefix .'%A ' .implode ("\n%A " , $ this ->expectedDeprecations )."\n%A " , $ prefix .' ' .implode ("\n " , $ this ->gatheredDeprecations )."\n" );
@@ -300,20 +300,20 @@ public function endTest($test, $time)
300
300
}
301
301
}
302
302
303
- $ this ->expectedDeprecations = $ this ->gatheredDeprecations = [] ;
303
+ $ this ->expectedDeprecations = $ this ->gatheredDeprecations = array () ;
304
304
$ this ->previousErrorHandler = null ;
305
305
}
306
306
if (!$ this ->runsInSeparateProcess && -2 < $ this ->state && ($ test instanceof \PHPUnit \Framework \TestCase || $ test instanceof TestCase)) {
307
307
if (\in_array ('time-sensitive ' , $ groups , true )) {
308
308
ClockMock::withClockMock (false );
309
309
}
310
310
if (\in_array ('dns-sensitive ' , $ groups , true )) {
311
- DnsMock::withMockedHosts ([] );
311
+ DnsMock::withMockedHosts (array () );
312
312
}
313
313
}
314
314
}
315
315
316
- public function handleError ($ type , $ msg , $ file , $ line , $ context = [] )
316
+ public function handleError ($ type , $ msg , $ file , $ line , $ context = array () )
317
317
{
318
318
if (E_USER_DEPRECATED !== $ type && E_DEPRECATED !== $ type ) {
319
319
$ h = $ this ->previousErrorHandler ;
0 commit comments