tags:

views:

191

answers:

4

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) {
A: 

Yes, bool works.

therefromhere
A: 

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.

Pascal MARTIN
great answer. vote limit reached today, can't vote up anymore. I'll do that a.s.a.p.
openfrog
This answer is misleading. phpDocumentor only supports valid PHP types, class names, and `mixed`.
Jordan Ryan Moore
A: 

bool is supported in phpDocumentor and phpXref.

C.

symcbean
+4  A: 

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)

Jordan Ryan Moore