143
143
}
144
144
}
145
145
146
- if ('disabled ' === $ getEnvVar ('SYMFONY_DEPRECATIONS_HELPER ' )) {
146
+ if ('disabled ' === $ getEnvVar ('SYMFONY_DEPRECATIONS_HELPER ' ) || version_compare ( $ PHPUNIT_VERSION , ' 11 ' , ' >= ' ) ) {
147
147
putenv ('SYMFONY_DEPRECATIONS_HELPER=disabled ' );
148
148
}
149
149
273
273
}
274
274
275
275
// Mutate TestCase code
276
- $ alteredCode = file_get_contents ($ alteredFile = './src/Framework/TestCase.php ' );
277
- if ($ PHPUNIT_REMOVE_RETURN_TYPEHINT ) {
278
- $ alteredCode = preg_replace ('/^ ((?:protected|public)(?: static)? function \w+\(\)): void/m ' , ' $1 ' , $ alteredCode );
279
- }
280
- $ alteredCode = preg_replace ('/abstract class TestCase[^\{]+\{/ ' , '$0 ' .\PHP_EOL ." use \Symfony\Bridge\PhpUnit\Legacy\PolyfillTestCaseTrait; " , $ alteredCode , 1 );
281
- file_put_contents ($ alteredFile , $ alteredCode );
276
+ if (version_compare ($ PHPUNIT_VERSION , '10 ' , '< ' )) {
277
+ $ alteredCode = file_get_contents ($ alteredFile = './src/Framework/TestCase.php ' );
278
+ if ($ PHPUNIT_REMOVE_RETURN_TYPEHINT ) {
279
+ $ alteredCode = preg_replace ('/^ ((?:protected|public)(?: static)? function \w+\(\)): void/m ' , ' $1 ' , $ alteredCode );
280
+ }
281
+ $ alteredCode = preg_replace ('/abstract class TestCase[^\{]+\{/ ' , '$0 ' .\PHP_EOL ." use \Symfony\Bridge\PhpUnit\Legacy\PolyfillTestCaseTrait; " , $ alteredCode , 1 );
282
+ file_put_contents ($ alteredFile , $ alteredCode );
282
283
283
- // Mutate Assert code
284
- $ alteredCode = file_get_contents ($ alteredFile = './src/Framework/Assert.php ' );
285
- $ alteredCode = preg_replace ('/abstract class Assert[^\{]+\{/ ' , '$0 ' .\PHP_EOL ." use \Symfony\Bridge\PhpUnit\Legacy\PolyfillAssertTrait; " , $ alteredCode , 1 );
286
- file_put_contents ($ alteredFile , $ alteredCode );
284
+ // Mutate Assert code
285
+ $ alteredCode = file_get_contents ($ alteredFile = './src/Framework/Assert.php ' );
286
+ $ alteredCode = preg_replace ('/abstract class Assert[^\{]+\{/ ' , '$0 ' .\PHP_EOL ." use \Symfony\Bridge\PhpUnit\Legacy\PolyfillAssertTrait; " , $ alteredCode , 1 );
287
+ file_put_contents ($ alteredFile , $ alteredCode );
287
288
288
- file_put_contents ('phpunit ' , <<<'EOPHP'
289
+ file_put_contents ('phpunit ' , <<<'EOPHP'
289
290
<?php
290
291
291
292
define('PHPUNIT_COMPOSER_INSTALL', __DIR__.'/vendor/autoload.php');
@@ -310,7 +311,9 @@ class_exists(\SymfonyExcludeListSimplePhpunit::class, false) && PHPUnit\Util\Bla
310
311
Symfony\Bridge\PhpUnit\TextUI\Command::main();
311
312
312
313
EOPHP
313
- );
314
+ );
315
+ }
316
+
314
317
chdir ('.. ' );
315
318
file_put_contents (". $ PHPUNIT_VERSION_DIR .md5 " , $ configurationHash );
316
319
chdir ($ oldPwd );
0 commit comments