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'; + } }