1515error_reporting (-1 );
1616
1717global $ argv , $ argc ;
18- $ argv = isset ($ _SERVER ['argv ' ]) ? $ _SERVER ['argv ' ] : array () ;
18+ $ argv = isset ($ _SERVER ['argv ' ]) ? $ _SERVER ['argv ' ] : [] ;
1919$ argc = isset ($ _SERVER ['argc ' ]) ? $ _SERVER ['argc ' ] : 0 ;
2020$ getEnvVar = function ($ name , $ default = false ) use ($ argv ) {
2121 if (false !== $ value = getenv ($ name )) {
130130 $ PHP .= ' -qrr ' ;
131131}
132132
133- $ defaultEnvs = array (
133+ $ defaultEnvs = [
134134 'COMPOSER ' => 'composer.json ' ,
135135 'COMPOSER_VENDOR_DIR ' => 'vendor ' ,
136136 'COMPOSER_BIN_DIR ' => 'bin ' ,
137- ) ;
137+ ] ;
138138
139139foreach ($ defaultEnvs as $ envName => $ envValue ) {
140140 if ($ envValue !== getenv ($ envName )) {
147147 || ($ COMPOSER = rtrim ('\\' === DIRECTORY_SEPARATOR ? preg_replace ('/[\r\n].*/ ' , '' , `where.exe composer.phar `) : `which composer.phar 2> /dev/null `))
148148 || ($ COMPOSER = rtrim ('\\' === DIRECTORY_SEPARATOR ? preg_replace ('/[\r\n].*/ ' , '' , `where.exe composer `) : `which composer 2> /dev/null `))
149149 || file_exists ($ COMPOSER = rtrim ('\\' === DIRECTORY_SEPARATOR ? `git rev-parse --show-toplevel 2> NUL ` : `git rev-parse --show-toplevel 2> /dev/null `).DIRECTORY_SEPARATOR .'composer.phar ' )
150- ? (file_get_contents ($ COMPOSER , false , null , 0 , 18 ) === ' #!/usr/bin/env php ' ? $ PHP : '' ).' ' .escapeshellarg ($ COMPOSER ) // detect shell wrappers by looking at the shebang
150+ ? (' #!/usr/bin/env php ' === file_get_contents ($ COMPOSER , false , null , 0 , 18 ) ? $ PHP : '' ).' ' .escapeshellarg ($ COMPOSER ) // detect shell wrappers by looking at the shebang
151151 : 'composer ' ;
152152
153- $ SYMFONY_PHPUNIT_REMOVE = $ getEnvVar ('SYMFONY_PHPUNIT_REMOVE ' , 'phpspec/prophecy ' .($ PHPUNIT_VERSION < 6.0 ? ' symfony/yaml ' : '' ));
154- $ configurationHash = md5 (implode (PHP_EOL , array ( md5_file (__FILE__ ), $ SYMFONY_PHPUNIT_REMOVE , (int ) $ PHPUNIT_REMOVE_RETURN_TYPEHINT ) ));
155- $ PHPUNIT_VERSION_DIR = sprintf ('phpunit-%s-%d ' , $ PHPUNIT_VERSION , $ PHPUNIT_REMOVE_RETURN_TYPEHINT );
153+ $ SYMFONY_PHPUNIT_REMOVE = $ getEnvVar ('SYMFONY_PHPUNIT_REMOVE ' , 'phpspec/prophecy ' .($ PHPUNIT_VERSION < 6.0 ? ' symfony/yaml ' : '' ));
154+ $ configurationHash = md5 (implode (PHP_EOL , [ md5_file (__FILE__ ), $ SYMFONY_PHPUNIT_REMOVE , (int ) $ PHPUNIT_REMOVE_RETURN_TYPEHINT ] ));
155+ $ PHPUNIT_VERSION_DIR = sprintf ('phpunit-%s-%d ' , $ PHPUNIT_VERSION , $ PHPUNIT_REMOVE_RETURN_TYPEHINT );
156156if (!file_exists ("$ PHPUNIT_DIR / $ PHPUNIT_VERSION_DIR /phpunit " ) || $ configurationHash !== @file_get_contents ("$ PHPUNIT_DIR /. $ PHPUNIT_VERSION_DIR .md5 " )) {
157157 // Build a standalone phpunit without symfony/yaml nor prophecy by default
158158
159159 @mkdir ($ PHPUNIT_DIR , 0777 , true );
160160 chdir ($ PHPUNIT_DIR );
161161 if (file_exists ("$ PHPUNIT_VERSION_DIR " )) {
162- passthru (sprintf ('\\' === DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s > NUL ' : 'rm -rf %s ' , "$ PHPUNIT_VERSION_DIR .old " ));
162+ passthru (sprintf ('\\' === DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s > NUL ' : 'rm -rf %s ' , "$ PHPUNIT_VERSION_DIR .old " ));
163163 rename ("$ PHPUNIT_VERSION_DIR " , "$ PHPUNIT_VERSION_DIR .old " );
164- passthru (sprintf ('\\' === DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s ' : 'rm -rf %s ' , "$ PHPUNIT_VERSION_DIR .old " ));
164+ passthru (sprintf ('\\' === DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s ' : 'rm -rf %s ' , "$ PHPUNIT_VERSION_DIR .old " ));
165165 }
166166 $ passthruOrFail ("$ COMPOSER create-project --no-install --prefer-dist --no-scripts --no-plugins --no-progress --ansi phpunit/phpunit $ PHPUNIT_VERSION_DIR \"$ PHPUNIT_VERSION .* \"" );
167167 @copy ("$ PHPUNIT_VERSION_DIR /phpunit.xsd " , 'phpunit.xsd ' );
187187 putenv ("COMPOSER_ROOT_VERSION= $ PHPUNIT_VERSION .99 " );
188188 $ q = '\\' === DIRECTORY_SEPARATOR ? '" ' : '' ;
189189 // --no-suggest is not in the list to keep compat with composer 1.0, which is shipped with Ubuntu 16.04LTS
190- $ exit = proc_close (proc_open ("$ q$ COMPOSER install --no-dev --prefer-dist --no-progress --ansi $ q " , array () , $ p , getcwd ()));
190+ $ exit = proc_close (proc_open ("$ q$ COMPOSER install --no-dev --prefer-dist --no-progress --ansi $ q " , [] , $ p , getcwd ()));
191191 putenv ('COMPOSER_ROOT_VERSION ' .(false !== $ prevRoot ? '= ' .$ prevRoot : '' ));
192192 if ($ exit ) {
193193 exit ($ exit );
@@ -233,13 +233,20 @@ class SymfonyBlacklistPhpunit {}
233233}
234234
235235if ($ PHPUNIT_VERSION < 8.0 ) {
236- $ argv = array_filter ($ argv , function ($ v ) use (&$ argc ) { if ('--do-not-cache-result ' !== $ v ) return true ; --$ argc ; return false ; });
236+ $ argv = array_filter ($ argv , function ($ v ) use (&$ argc ) {
237+ if ('--do-not-cache-result ' !== $ v ) {
238+ return true ;
239+ }
240+ --$ argc ;
241+
242+ return false ;
243+ });
237244} elseif (filter_var (getenv ('SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE ' ), FILTER_VALIDATE_BOOLEAN )) {
238245 $ argv [] = '--do-not-cache-result ' ;
239246 ++$ argc ;
240247}
241248
242- $ components = array () ;
249+ $ components = [] ;
243250$ cmd = array_map ('escapeshellarg ' , $ argv );
244251$ exit = 0 ;
245252
@@ -274,7 +281,7 @@ class SymfonyBlacklistPhpunit {}
274281
275282if ($ components ) {
276283 $ skippedTests = isset ($ _SERVER ['SYMFONY_PHPUNIT_SKIPPED_TESTS ' ]) ? $ _SERVER ['SYMFONY_PHPUNIT_SKIPPED_TESTS ' ] : false ;
277- $ runningProcs = array () ;
284+ $ runningProcs = [] ;
278285
279286 foreach ($ components as $ component ) {
280287 // Run phpunit tests in parallel
@@ -285,7 +292,7 @@ class SymfonyBlacklistPhpunit {}
285292
286293 $ c = escapeshellarg ($ component );
287294
288- if ($ proc = proc_open (sprintf ($ cmd , $ c , " > $ c/phpunit.stdout 2> $ c/phpunit.stderr " ), array () , $ pipes )) {
295+ if ($ proc = proc_open (sprintf ($ cmd , $ c , " > $ c/phpunit.stdout 2> $ c/phpunit.stderr " ), [] , $ pipes )) {
289296 $ runningProcs [$ component ] = $ proc ;
290297 } else {
291298 $ exit = 1 ;
@@ -295,7 +302,7 @@ class SymfonyBlacklistPhpunit {}
295302
296303 while ($ runningProcs ) {
297304 usleep (300000 );
298- $ terminatedProcs = array () ;
305+ $ terminatedProcs = [] ;
299306 foreach ($ runningProcs as $ component => $ proc ) {
300307 $ procStatus = proc_get_status ($ proc );
301308 if (!$ procStatus ['running ' ]) {
@@ -306,7 +313,7 @@ class SymfonyBlacklistPhpunit {}
306313 }
307314
308315 foreach ($ terminatedProcs as $ component => $ procStatus ) {
309- foreach (array ( 'out ' , 'err ' ) as $ file ) {
316+ foreach ([ 'out ' , 'err ' ] as $ file ) {
310317 $ file = "$ component/phpunit.std $ file " ;
311318 readfile ($ file );
312319 unlink ($ file );
@@ -316,7 +323,7 @@ class SymfonyBlacklistPhpunit {}
316323 // STATUS_STACK_BUFFER_OVERRUN (-1073740791/0xC0000409)
317324 // STATUS_ACCESS_VIOLATION (-1073741819/0xC0000005)
318325 // STATUS_HEAP_CORRUPTION (-1073740940/0xC0000374)
319- if ($ procStatus && ('\\' !== DIRECTORY_SEPARATOR || !extension_loaded ('apcu ' ) || !filter_var (ini_get ('apc.enable_cli ' ), FILTER_VALIDATE_BOOLEAN ) || !in_array ($ procStatus , array ( -1073740791 , -1073741819 , -1073740940 ) ))) {
326+ if ($ procStatus && ('\\' !== DIRECTORY_SEPARATOR || !extension_loaded ('apcu ' ) || !filter_var (ini_get ('apc.enable_cli ' ), FILTER_VALIDATE_BOOLEAN ) || !in_array ($ procStatus , [ -1073740791 , -1073741819 , -1073740940 ] ))) {
320327 $ exit = $ procStatus ;
321328 echo "\033[41mKO \033[0m $ component \n\n" ;
322329 } else {
@@ -326,9 +333,11 @@ class SymfonyBlacklistPhpunit {}
326333 }
327334} elseif (!isset ($ argv [1 ]) || 'install ' !== $ argv [1 ] || file_exists ('install ' )) {
328335 if (!class_exists ('SymfonyBlacklistSimplePhpunit ' , false )) {
329- class SymfonyBlacklistSimplePhpunit {}
336+ class SymfonyBlacklistSimplePhpunit
337+ {
338+ }
330339 }
331- array_splice ($ argv , 1 , 0 , array ( '--colors=always ' ) );
340+ array_splice ($ argv , 1 , 0 , [ '--colors=always ' ] );
332341 $ _SERVER ['argv ' ] = $ argv ;
333342 $ _SERVER ['argc ' ] = ++$ argc ;
334343 include "$ PHPUNIT_DIR / $ PHPUNIT_VERSION_DIR /phpunit " ;
0 commit comments