Since PHP 7.0 it's possible to specify returning types to functions & methods (examples from php.net):
More yet, since PHP 7.1 (so, eligible for Moodle 3.7 and up) it's also possible to use the nullify operator to allow also nulls to be returned:
This issue (followup of
MDLSITE-5660) is about to decide if we want to rule how to write code using those return types, both spacing and the "?" symbol. Basically, between:
A) function xxx(): [?]int <<== default syntax used in php site
B) function xxx() : [?]int <<== already used syntax in core - privacy stuff mainly
C) Current status, unruled. Basically any number of chars is allowed. See this fixture file to view all the crazy possibilities.