Skip to content

Commit 35d8013

Browse files
committed
test: Proof @param ?string is supported in current setup
1 parent 06f0b06 commit 35d8013

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

tests/DispatcherTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,10 @@ public function testCallMethodWithTypeHintWithNamedArgsOnNestedTarget()
7272
$this->assertEquals($this->callsOfNestedTarget, [new MethodCall('someMethodWithTypeHint', [new Argument('whatever')])]);
7373
}
7474

75-
75+
public function testSomeMethodWithNullableTypeParamTag(): void
76+
{
77+
$result = $this->dispatcher->dispatch((string)new Request(1, 'someMethodWithNullableTypeParamTag', ['arg' => null]));
78+
$this->assertEquals('Hello World', $result);
79+
$this->assertEquals($this->calls, [new MethodCall('someMethodWithNullableTypeParamTag', [null])]);
80+
}
7681
}

tests/Target.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,13 @@ public function someMethodWithDifferentlyTypedArgs(string $arg1 = null, int $arg
4949
$this->calls[] = new MethodCall('someMethodWithDifferentlyTypedArgs', func_get_args());
5050
return 'Hello World';
5151
}
52+
53+
/**
54+
* @param ?string $arg
55+
*/
56+
public function someMethodWithNullableTypeParamTag($arg): string
57+
{
58+
$this->calls[] = new MethodCall('someMethodWithNullableTypeParamTag', func_get_args());
59+
return 'Hello World';
60+
}
5261
}

0 commit comments

Comments
 (0)