phpDocumentor and documenting global variables

mychel_normandeau
mychel_normandeau used Ask the Experts™
on
I'm new with phpDocumentor and so far so good, but I have a question that I didn't catch in the manual... The documentation of global variables.

How would I document this code (see below) if:

1) $someGlobalVar is not decalren in the same PHP file of the class (it is even possible that it's not declared anywhere).
2) $someGlobalVar is declared like this: $someGlobalVar = array(); (not using the superglobal array like in the phpDocumentor manual).

Do I have to declare de global with @global in the PHP file of the class (even if not declared there))?
Do I have to use @name?
class myCustomClass 
{ 
    private $someProperty; 
 
    //I want to document the use of global var in this method 
    public function getSomeProperty() 
    { 
        global $someGlobalVar; 
        if (isset($someGlobalVar))
        {
            //... 
        }
    } 
}

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Richard QuadlingSenior Software Developer

Commented:
@global datatype $globalvariablename
@global datatype description

http://manual.phpdoc.org/HTMLframesConverter/phphtmllib/phpDocumentor/tutorial_tags.global.pkg.html

Author

Commented:
I know I read the manyal please reread my question... The global variable is user defined (it's not declared in my class) but it's used if defined in my class... In this situation, how do I document it's use?
Senior Software Developer
Commented:
Aha!@uses $name Using something called $name - it may be defined. If it is, then we may even get a link!I use @uses in my docs to allow me to describe the dependencies of different methods.The element being used may or may not be a class property/method, a global function/variable, declared locally or via an include or not even exist at all.http://manual.phpdoc.org/HTMLframesConverter/phphtmllib/phpDocumentor/tutorial_tags.uses.pkg.html

Author

Commented:
Thanks!
Richard QuadlingSenior Software Developer

Commented:
On the grounds I'd like to make sure I gave the best answer I could, what could I have done for the A grade?

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial