I wasn't able to find an overview of the types which can be hinted with PHPDoc. I know array or string, but is there also bool? Like:
/**
* @param bool loadLazy
* @return array Array with objects
*/
public function getObjects($loadLazy=false) {
I wasn't able to find an overview of the types which can be hinted with PHPDoc. I know array or string, but is there also bool? Like:
/**
* @param bool loadLazy
* @return array Array with objects
*/
public function getObjects($loadLazy=false) {
As a "type hint" is only a "hint", I would say you can use pretty much whatever you like.
Still, I tend to use the types that are found in the official PHP manual -- which means, for a Boolean, I would use boolean
.
According to the documentation, you can use any valid PHP type, class names, or mixed
. You can also list multiple types by separating them with a |
(e.g., @param int|bool $var
)