Skip to content

Commit 80b949f

Browse files
committed
test: Proof @param ?string is supported in current setup
1 parent b39a137 commit 80b949f

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

tests/DispatcherTest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function testCallMethodWithArrayTypeHintAndDocblock(): void
7777
$this->assertEquals('Hello World', $result);
7878
$this->assertEquals($this->calls, [new MethodCall('someMethodWithArrayTypeHint', [[new Argument('1'), new Argument('2')]])]);
7979
}
80-
80+
8181
public function testCallMethodWithAdditionalProvidedParamsOnSomeMethodWithoutArgs()
8282
{
8383
$result = $this->dispatcher->dispatch((string) new Request(1, 'someMethodWithoutArgs', ['arg' => new Argument('whatever')]));
@@ -91,4 +91,11 @@ public function testCallMethodWithAdditionalProvidedParamsOnSomeMethodWithTypeHi
9191
$this->assertEquals('Hello World', $result);
9292
$this->assertEquals($this->calls, [new MethodCall('someMethodWithTypeHint', [new Argument('whatever')])]);
9393
}
94+
95+
public function testSomeMethodWithNullableTypeParamTag(): void
96+
{
97+
$result = $this->dispatcher->dispatch((string)new Request(1, 'someMethodWithNullableTypeParamTag', ['arg' => null]));
98+
$this->assertEquals('Hello World', $result);
99+
$this->assertEquals($this->calls, [new MethodCall('someMethodWithNullableTypeParamTag', [null])]);
100+
}
94101
}

tests/Target.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,13 @@ public function someMethodWithArrayTypeHint(array $args): string
5858
$this->calls[] = new MethodCall('someMethodWithArrayTypeHint', func_get_args());
5959
return 'Hello World';
6060
}
61+
62+
/**
63+
* @param ?string $arg
64+
*/
65+
public function someMethodWithNullableTypeParamTag($arg): string
66+
{
67+
$this->calls[] = new MethodCall('someMethodWithNullableTypeParamTag', func_get_args());
68+
return 'Hello World';
69+
}
6170
}

0 commit comments

Comments
 (0)