From ed5bd5272e53d9f49725704af81b4ba1242a8fc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Fri, 17 Jun 2022 14:24:45 +0200 Subject: [PATCH] Update test suite to avoid deprecation notices for PHP 8.1+ --- phpunit.xml.dist | 6 +++++- tests/Internal/RejectedPromiseTest.php | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 5c44c780..413f166a 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -4,8 +4,9 @@ + convertDeprecationsToExceptions="true"> ./tests/ @@ -19,4 +20,7 @@ ./src/functions_include.php + + + diff --git a/tests/Internal/RejectedPromiseTest.php b/tests/Internal/RejectedPromiseTest.php index 028ca4dc..e2e7a15f 100644 --- a/tests/Internal/RejectedPromiseTest.php +++ b/tests/Internal/RejectedPromiseTest.php @@ -29,15 +29,15 @@ public function getPromiseTestAdapter(callable $canceller = null) 'resolve' => function () { throw new LogicException('You cannot call resolve() for React\Promise\RejectedPromise'); }, - 'reject' => function ($reason = null) use (&$promise) { + 'reject' => function (\Throwable $reason) use (&$promise) { if (!$promise) { $promise = new RejectedPromise($reason); } }, - 'settle' => function ($reason = "") use (&$promise) { + 'settle' => function ($reason = '') use (&$promise) { if (!$promise) { if (!$reason instanceof Exception) { - $reason = new Exception($reason); + $reason = new Exception((string) $reason); } $promise = new RejectedPromise($reason);