Closed
Description
Symfony version(s) affected: 5.3.0
Description
Method getPhpUnitErrorHandler
Method checks if PHPUnit\Util\ErrorHandler
class exists. However in PHPUnit 10 they changed the name of that class to: PHPUnit\Util\Error\Handler
This is why you should add one more condition to check if you are between 8.3 and 10 version of PHPUnit. Then you have to create a proper error Handler
.
Some dirty fix:
use PHPUnit\Util\Error\Handler;
private static $isAtLeastPhpUnit100;
...
if (!isset(self::$isAtLeastPhpUnit83)) {
self::$isAtLeastPhpUnit83 = class_exists(ErrorHandler::class) && method_exists(ErrorHandler::class, '__invoke');
}
if (!isset(self::$isAtLeastPhpUnit100)) {
self::$isAtLeastPhpUnit100 = class_exists(Handler::class) && method_exists(Handler::class, '__invoke');
}
...
if (!self::$isAtLeastPhpUnit100) {
return new ErrorHandler();
} else {
return new Handler();
}