php method argument type hinting with question mark (?type) [duplicate]

It’s a new feature in php7.1

http://php.net/manual/en/migration71.new-features.php

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.

Leave a Comment