I just felt on pieces of php (symfony/laravel) code using question mark in method type hints :
public function functionName(?int $arg = 0)
In other occasions the ?type was not the last one, but I did not find any of these with no default yet.
Problem is, I cannot find any information about this, and I checked :
- here : http://php.net/manual/en/migration70.new-features.php
- and here : http://php.net/manual/en/migration71.new-features.php
- and here : http://php.net/manual/en/functions.arguments.php
And same with 7.2, but since the code only requires 7.1, it seems rather normal.
I also googled, and searched here, but either this is not documented or the question marks topic is defeating search engines.
So I feel a little dumb now, and I would really appreciate if someone could enlighten me on the significance of this question mark in method signatures arguments.
Thanks