Skip to content

Commit 28b4951

Browse files
authored
Update phpdoc-types.md
1 parent e03b76c commit 28b4951

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

website/src/writing-php-code/phpdoc-types.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ Callables
186186
The `callable` typehint has been in PHP for a long time. But it doesn't allow enforcing specific callback signatures. However, PHPStan allows and enforce specific signatures in PHPDocs:
187187

188188
* `callable(int, int): string` (accepts two integers, returns a string)
189+
* `callable(int, int=): string` (second parameter is optional)
189190
* `callable(int $foo, string $bar): void` (accepts an integer and a string, doesn't return anything; parameter names are optional and insignificant)
190191
* `callable(string &$bar): mixed` (accepts a string parameter passed by reference, returns `mixed`)
191192
* `callable(float ...$floats): (int|null)` (accepts multiple variadic float arguments, returns integer or null)

0 commit comments

Comments
 (0)