Ankit Garg
Ankit Garg

Reputation: 719

phpDoc - Documenting for private members holding class instances

I have a class to document. There is a variable holding class instance which will be initialized in the constructor. I want to know how I can document (or put the tags) so that variable type is reflected properly.

I have done this so far:

/**
 * Holds the instance of ParseMessage class
 *
 * @access private
 * @var ParseMessage
 */
 private $_parse_message;

The Doc generated for this member looks like this:

Holds the instance of ParseMessage class
$_parse_message : **\ParseMessage**

I want to remove this '\' before the type of the variable.

Upvotes: 3

Views: 550

Answers (1)

WWW
WWW

Reputation: 9860

The leading slash is probably there because of how phpDoc handles namespacing. Classes with a leading \ are in the global namespace. Apart from putting your class into its own namespace (as you said you'd do with this particular class), I couldn't find a setting that would make phpDoc omit the leading slash on global namespace classes.

Upvotes: 1

Related Questions