What is the correct syntax for me to specify the return type hints for a method?
For example, I have such a method:
private static function Construct
For future reference, this is implemented for PHP 7, with the following syntax (quoted from source):
function foo(): array {
return [];
}
To answer your question now, as of PHP 7 (released around end of 2015) you will be able to do the following (as an example):
The specification also allows for type hinting within and against interfaces; for those of us interested in adhering to SOLID principles.
Source and more information: https://wiki.php.net/rfc/return_types