From 5b8c3f8570aa9c8824665b691dba367d133ffc68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Glawaty?= Date: Thu, 23 Nov 2023 05:00:37 +0100 Subject: [PATCH] Tests - disabled E_DEPRECATED from vendor code --- tests/bootstrap.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index c347ebe..3a096b6 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -14,4 +14,15 @@ Environment::setup(); Environment::bypassFinals(); +# disable E_DEPRECATED errors from the vendor code (some nette packages before v3.1 are not fully compatible with PHP 8.1/8.2) +$previousHandler = set_error_handler(static function (int $errNo, string $errStr, string $errFile, int $errLine) use (&$previousHandler): bool { + $vendor = realpath(__DIR__ . '/../vendor'); + + if (E_DEPRECATED === $errNo && 0 === strncmp($errFile, $vendor, strlen($vendor))) { + return true; + } + + return $previousHandler($errNo, $errStr, $errFile, $errLine); +}); + return $loader;