You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/src/writing-php-code/phpdoc-types.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -186,6 +186,7 @@ Callables
186
186
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:
187
187
188
188
*`callable(int, int): string` (accepts two integers, returns a string)
189
+
*`callable(int, int=): string` (second parameter is optional)
189
190
*`callable(int $foo, string $bar): void` (accepts an integer and a string, doesn't return anything; parameter names are optional and insignificant)
190
191
*`callable(string &$bar): mixed` (accepts a string parameter passed by reference, returns `mixed`)
0 commit comments