From c93186751d4e878d863cc18bd06382faa7c767f2 Mon Sep 17 00:00:00 2001 From: Serge Kvashnin <75180587+serge-kvashnin@users.noreply.github.com> Date: Wed, 4 Oct 2023 18:33:30 +0200 Subject: [PATCH] Skip "optional before required" test for PHP >= 8.1. --- tests/InvokerTest.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/InvokerTest.php b/tests/InvokerTest.php index 94109b7..4294abd 100644 --- a/tests/InvokerTest.php +++ b/tests/InvokerTest.php @@ -216,10 +216,16 @@ public function should_invoke_callable_with_null_for_non_optional_nullable_param /** * @see https://github.com/PHP-DI/PHP-DI/issues/562 + * @deprecated * @test */ public function should_invoke_callable_with_optional_parameter_before_required_parameter() { + if (version_compare(PHP_VERSION, '8.1') >= 0) { + /** @see https://www.php.net/manual/en/migration81.incompatible.php#migration81.incompatible.core.optional-before-required */ + $this->markTestSkipped('An optional parameter specified before required parameters is now always treated as required.'); + } + $result = $this->invoker->call(function ($baz = 'abc', $foo) { return [$baz, $foo]; }, [