From e7d79b45f9cf02fcdb4ab7111b2133979a640114 Mon Sep 17 00:00:00 2001 From: Danny van der Sluijs Date: Mon, 11 Jan 2021 21:44:12 +0100 Subject: [PATCH] Proof @param ?string is supported in current setup --- tests/DispatcherTest.php | 7 ++++++- tests/Target.php | 9 +++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/DispatcherTest.php b/tests/DispatcherTest.php index 8b54d06..e4d33b1 100644 --- a/tests/DispatcherTest.php +++ b/tests/DispatcherTest.php @@ -72,5 +72,10 @@ public function testCallMethodWithTypeHintWithNamedArgsOnNestedTarget() $this->assertEquals($this->callsOfNestedTarget, [new MethodCall('someMethodWithTypeHint', [new Argument('whatever')])]); } - + public function testSomeMethodWithNullableTypeParamTag(): void + { + $result = $this->dispatcher->dispatch((string)new Request(1, 'someMethodWithNullableTypeParamTag', ['arg' => null])); + $this->assertEquals('Hello World', $result); + $this->assertEquals($this->calls, [new MethodCall('someMethodWithNullableTypeParamTag', [null])]); + } } diff --git a/tests/Target.php b/tests/Target.php index 84ece52..522d39f 100644 --- a/tests/Target.php +++ b/tests/Target.php @@ -49,4 +49,13 @@ public function someMethodWithDifferentlyTypedArgs(string $arg1 = null, int $arg $this->calls[] = new MethodCall('someMethodWithDifferentlyTypedArgs', func_get_args()); return 'Hello World'; } + + /** + * @param ?string $arg + */ + public function someMethodWithNullableTypeParamTag($arg): string + { + $this->calls[] = new MethodCall('someMethodWithNullableTypeParamTag', func_get_args()); + return 'Hello World'; + } }