From fe41e56ab97bb2b3c67c7d3c9d3f083cfa79e44e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Sat, 24 Oct 2026 23:35:19 +0200 Subject: [PATCH] Improve PHP 8.6+ support by avoiding `spl_object_hash()` in tests --- tests/ContainerTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/ContainerTest.php b/tests/ContainerTest.php index b4e51ae..96809e6 100644 --- a/tests/ContainerTest.php +++ b/tests/ContainerTest.php @@ -312,8 +312,8 @@ public function __invoke(ServerRequestInterface $request): Response }; $container = new Container([ - \stdClass::class => function (Container $container) { - return (object)['container' => spl_object_hash($container)]; + \stdClass::class => function (Container $instance) use (&$container) { + return (object)['container' => $instance === $container]; } ]); @@ -323,7 +323,7 @@ public function __invoke(ServerRequestInterface $request): Response $response = $callable($request); $this->assertInstanceOf(ResponseInterface::class, $response); $this->assertEquals(200, $response->getStatusCode()); - $this->assertEquals('{"container":"' . spl_object_hash($container) . '"}', (string) $response->getBody()); + $this->assertEquals('{"container":true}', (string) $response->getBody()); } public function testCallableTwiceReturnsCallableForClassNameViaAutowiringWithFactoryFunctionForDependencyWillCallFactoryOnlyOnce(): void