Skip to content

Commit

Permalink
test: Proof @param ?string is supported in current setup
Browse files Browse the repository at this point in the history
  • Loading branch information
DannyvdSluijs committed Jun 13, 2021
1 parent 06f0b06 commit 35d8013
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/DispatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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])]);
}
}
9 changes: 9 additions & 0 deletions tests/Target.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
}

0 comments on commit 35d8013

Please sign in to comment.