diff --git a/tests/DispatcherTest.php b/tests/DispatcherTest.php index 1b2eaa4..f98ba5b 100644 --- a/tests/DispatcherTest.php +++ b/tests/DispatcherTest.php @@ -77,7 +77,7 @@ public function testCallMethodWithArrayTypeHintAndDocblock(): void $this->assertEquals('Hello World', $result); $this->assertEquals($this->calls, [new MethodCall('someMethodWithArrayTypeHint', [[new Argument('1'), new Argument('2')]])]); } - + public function testCallMethodWithAdditionalProvidedParamsOnSomeMethodWithoutArgs() { $result = $this->dispatcher->dispatch((string) new Request(1, 'someMethodWithoutArgs', ['arg' => new Argument('whatever')])); @@ -91,4 +91,11 @@ public function testCallMethodWithAdditionalProvidedParamsOnSomeMethodWithTypeHi $this->assertEquals('Hello World', $result); $this->assertEquals($this->calls, [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 e9651ce..fd7afd9 100644 --- a/tests/Target.php +++ b/tests/Target.php @@ -58,4 +58,13 @@ public function someMethodWithArrayTypeHint(array $args): string $this->calls[] = new MethodCall('someMethodWithArrayTypeHint', 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'; + } }