@@ -31,10 +31,10 @@ class SymfonyTestsListenerTrait
3131 private static $ globallyEnabled = false ;
3232 private $ state = -1 ;
3333 private $ skippedFile = false ;
34- private $ wasSkipped = [] ;
35- private $ isSkipped = [] ;
36- private $ expectedDeprecations = [] ;
37- private $ gatheredDeprecations = [] ;
34+ private $ wasSkipped = array () ;
35+ private $ isSkipped = array () ;
36+ private $ expectedDeprecations = array () ;
37+ private $ gatheredDeprecations = array () ;
3838 private $ previousErrorHandler ;
3939 private $ testsWithWarnings ;
4040 private $ reportUselessTests ;
@@ -44,7 +44,7 @@ class SymfonyTestsListenerTrait
4444 /**
4545 * @param array $mockedNamespaces List of namespaces, indexed by mocked features (time-sensitive or dns-sensitive)
4646 */
47- public function __construct (array $ mockedNamespaces = [] )
47+ public function __construct (array $ mockedNamespaces = array () )
4848 {
4949 if (class_exists ('PHPUnit_Util_Blacklist ' )) {
5050 \PHPUnit_Util_Blacklist::$ blacklistedClassNames ['\Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerTrait ' ] = 2 ;
@@ -55,7 +55,7 @@ public function __construct(array $mockedNamespaces = [])
5555 $ warn = false ;
5656 foreach ($ mockedNamespaces as $ type => $ namespaces ) {
5757 if (!\is_array ($ namespaces )) {
58- $ namespaces = [ $ namespaces] ;
58+ $ namespaces = array ( $ namespaces) ;
5959 }
6060 if (\is_int ($ type )) {
6161 // @deprecated BC with v2.8 to v3.0
@@ -104,7 +104,7 @@ public function startTestSuite($suite)
104104 $ Test = 'PHPUnit\Util\Test ' ;
105105 }
106106 $ suiteName = $ suite ->getName ();
107- $ this ->testsWithWarnings = [] ;
107+ $ this ->testsWithWarnings = array () ;
108108
109109 foreach ($ suite ->tests () as $ test ) {
110110 if (!($ test instanceof \PHPUnit \Framework \TestCase || $ test instanceof TestCase)) {
@@ -135,11 +135,11 @@ public function startTestSuite($suite)
135135
136136 if (!$ this ->wasSkipped = require $ this ->skippedFile ) {
137137 echo "All tests already ran successfully. \n" ;
138- $ suite ->setTests ([] );
138+ $ suite ->setTests (array () );
139139 }
140140 }
141141 }
142- $ testSuites = [ $ suite] ;
142+ $ testSuites = array ( $ suite) ;
143143 for ($ i = 0 ; isset ($ testSuites [$ i ]); ++$ i ) {
144144 foreach ($ testSuites [$ i ]->tests () as $ test ) {
145145 if ($ test instanceof \PHPUnit_Framework_TestSuite || $ test instanceof TestSuite) {
@@ -158,7 +158,7 @@ public function startTestSuite($suite)
158158 }
159159 }
160160 } elseif (2 === $ this ->state ) {
161- $ skipped = [] ;
161+ $ skipped = array () ;
162162 foreach ($ suite ->tests () as $ test ) {
163163 if (!($ test instanceof \PHPUnit \Framework \TestCase || $ test instanceof TestCase)
164164 || isset ($ this ->wasSkipped [$ suiteName ]['* ' ])
@@ -230,7 +230,7 @@ public function startTest($test)
230230 $ test ->getTestResultObject ()->beStrictAboutTestsThatDoNotTestAnything (false );
231231
232232 $ this ->expectedDeprecations = $ annotations ['method ' ]['expectedDeprecation ' ];
233- $ this ->previousErrorHandler = set_error_handler ([ $ this , 'handleError ' ] );
233+ $ this ->previousErrorHandler = set_error_handler (array ( $ this , 'handleError ' ) );
234234 }
235235 }
236236 }
@@ -271,8 +271,8 @@ public function endTest($test, $time)
271271 $ deprecations = file_get_contents ($ this ->runsInSeparateProcess );
272272 unlink ($ this ->runsInSeparateProcess );
273273 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 ) );
276276 if ($ deprecation [0 ]) {
277277 @trigger_error ($ error , E_USER_DEPRECATED );
278278 } else {
@@ -283,13 +283,13 @@ public function endTest($test, $time)
283283 }
284284
285285 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 )) {
287287 $ test ->addToAssertionCount (\count ($ this ->expectedDeprecations ));
288288 }
289289
290290 restore_error_handler ();
291291
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 )) {
293293 try {
294294 $ prefix = "@expectedDeprecation: \n" ;
295295 $ test ->assertStringMatchesFormat ($ prefix .'%A ' .implode ("\n%A " , $ this ->expectedDeprecations )."\n%A " , $ prefix .' ' .implode ("\n " , $ this ->gatheredDeprecations )."\n" );
@@ -300,15 +300,15 @@ public function endTest($test, $time)
300300 }
301301 }
302302
303- $ this ->expectedDeprecations = $ this ->gatheredDeprecations = [] ;
303+ $ this ->expectedDeprecations = $ this ->gatheredDeprecations = array () ;
304304 $ this ->previousErrorHandler = null ;
305305 }
306306 if (!$ this ->runsInSeparateProcess && -2 < $ this ->state && ($ test instanceof \PHPUnit \Framework \TestCase || $ test instanceof TestCase)) {
307307 if (\in_array ('time-sensitive ' , $ groups , true )) {
308308 ClockMock::withClockMock (false );
309309 }
310310 if (\in_array ('dns-sensitive ' , $ groups , true )) {
311- DnsMock::withMockedHosts ([] );
311+ DnsMock::withMockedHosts (array () );
312312 }
313313 }
314314
@@ -329,7 +329,7 @@ public function endTest($test, $time)
329329 }
330330 }
331331
332- public function handleError ($ type , $ msg , $ file , $ line , $ context = [] )
332+ public function handleError ($ type , $ msg , $ file , $ line , $ context = array () )
333333 {
334334 if (E_USER_DEPRECATED !== $ type && E_DEPRECATED !== $ type ) {
335335 $ h = $ this ->previousErrorHandler ;
0 commit comments