diff --git a/composer.json b/composer.json index 10433c0..4276e5b 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ ], "require": { "php": "^5.5 || ^7.0 || ^8.0", - "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.0 || ^9.0" + "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.0 || ^9.0 || ^10.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^2", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 0493a2b..a2b5dc6 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,10 +1,14 @@ - - - - src - - + + + + ./src + + tests diff --git a/src/PolyfillTrait.php b/src/PolyfillTrait.php index 0381233..df04b5a 100644 --- a/src/PolyfillTrait.php +++ b/src/PolyfillTrait.php @@ -16,9 +16,13 @@ trait PolyfillTrait { use PolyfillTrait6; } -} else { +} elseif (version_compare(\PHPUnit\Runner\Version::id(), '10.0.0') < 0) { trait PolyfillTrait { use PolyfillTrait7; } +} else { + trait PolyfillTrait + { + } } diff --git a/src/aliases.php b/src/aliases.php index ee4d7e4..d343447 100644 --- a/src/aliases.php +++ b/src/aliases.php @@ -9,18 +9,13 @@ * with this source code in the file LICENSE. */ -if (!class_exists('PHPUnit\Framework\Error\Warning')) { - class_alias('PHPUnit_Framework_Error_Warning', 'PHPUnit\Framework\Error\Warning'); -} - -if (!class_exists('PHPUnit\Framework\ExpectationFailedException')) { - class_alias('PHPUnit_Framework_ExpectationFailedException', 'PHPUnit\Framework\ExpectationFailedException'); -} - -if (!class_exists('PHPUnit\Framework\TestCase')) { - class_alias('PHPUnit_Framework_TestCase', 'PHPUnit\Framework\TestCase'); -} - -if (!class_exists('PHPUnit\Runner\Version')) { - class_alias('PHPUnit_Runner_Version', 'PHPUnit\Runner\Version'); +foreach ([ + 'PHPUnit_Framework_Error_Warning' => 'PHPUnit\Framework\Error\Warning', + 'PHPUnit_Framework_ExpectationFailedException' => 'PHPUnit\Framework\ExpectationFailedException', + 'PHPUnit_Framework_TestCase' => 'PHPUnit\Framework\TestCase', + 'PHPUnit_Runner_Version' => 'PHPUnit\Runner\Version', +] as $old => $new) { + if (!class_exists($new) && class_exists($old)) { + class_alias($old, $new); + } }