Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

phpDoc - Documenting for private members holding class instances

Tags:

php

phpdoc

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.

like image 911
Ankit Garg Avatar asked Nov 19 '25 23:11

Ankit Garg


1 Answers

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.

like image 104
WWW Avatar answered Nov 21 '25 12:11

WWW