From 306e7a88e3dbf2b74ef857a2964fa5df9f16a6e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Gagnon-Grenier?= Date: Thu, 4 Mar 2021 15:27:27 -0500 Subject: [PATCH] Add test failing on array types on PHP 8+ (#191) --- test/InjectorTest.php | 7 +++++++ test/fixtures.php | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/test/InjectorTest.php b/test/InjectorTest.php index 4228e56..60977b8 100644 --- a/test/InjectorTest.php +++ b/test/InjectorTest.php @@ -7,6 +7,13 @@ class InjectorTest extends TestCase { + public function testArrayTypehintDoesNotEvaluatesAsClass() + { + $injector = new Injector; + $injector->defineParam('parameter', []); + $injector->execute('Auryn\Test\hasArrayDependency'); + } + public function testMakeInstanceInjectsSimpleConcreteDependency() { $injector = new Injector; diff --git a/test/fixtures.php b/test/fixtures.php index f594f35..c562e0a 100644 --- a/test/fixtures.php +++ b/test/fixtures.php @@ -426,6 +426,11 @@ public function __invoke() } } +function hasArrayDependency(array $parameter) +{ + return 42; +} + function testExecuteFunction() { return 42;