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 :
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 signification of this question mark in method signatures arguments.
Thanks
解决方案
It's a new feature in php7.1
A question mark means that the type hinted parameter (or return value) is also allowed to be null.
So in your example $arg can be null or any integer.