The @var
keyword can be used to describe the type and usage of:
class Example {
/** @var string This is something that stays the same */
const UNCHANGING = "Untouchable";
/** @var string $some_str This is some string */
public $some_str;
/**
* @var array $stuff This is a collection of stuff
* @var array $nonsense These are nonsense
*/
private $stuff, $nonsense;
...
}
The type can be one of the built-in PHP types, or a user-defined class, including namespaces.
The name of the variable should be included, but can be omitted if the docblock applies to only one item.