Skip to content

Commit 1c22660

Browse files
committed
Fix unitialized variable in DeprecationErrorHandler
1 parent 1680381 commit 1c22660

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

DeprecationErrorHandler.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ public static function register($mode = 0)
4848
}
4949

5050
$UtilPrefix = class_exists('PHPUnit_Util_ErrorHandler') ? 'PHPUnit_Util_' : 'PHPUnit\Util\\';
51-
self::$isAtLeastPhpUnit83 = method_exists('PHPUnit\Util\ErrorHandler', '__invoke');
5251

5352
$getMode = function () use ($mode) {
5453
static $memoizedMode = false;
@@ -304,6 +303,9 @@ public static function collectDeprecations($outputFile)
304303
*/
305304
public static function getPhpUnitErrorHandler()
306305
{
306+
if (!isset(self::$isAtLeastPhpUnit83)) {
307+
self::$isAtLeastPhpUnit83 = class_exists(ErrorHandler::class) && method_exists(ErrorHandler::class, '__invoke');
308+
}
307309
if (!self::$isAtLeastPhpUnit83) {
308310
return (class_exists('PHPUnit_Util_ErrorHandler', false) ? 'PHPUnit_Util_' : 'PHPUnit\Util\\').'ErrorHandler::handleError';
309311
}

0 commit comments

Comments
 (0)