First day I use 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 if:
- $someGlobalVar is not decalren in the PHP file of the class (it can even be undelared).
- $someGlobalVar is declared like this: $someGlobalVar = array(); (not using the superglobal array like in the phpDocumentor manual).
The PHP code:
class myCustomClass
{
private $someProperty;
//I want to document the use of global var in this method
public function getSomeProperty()
{
global $someGlobalVar;
if (isset($someGlobalVar))
{
//...
}
else
{
//...
}
}
}
Edit: I want do document these globals as the manual shows but I'm not sure how/where to put the @global and @name tags.
Edit 2: I ended up using the following snippet just before the declaration of getSomeProperty:
/**
* Get some property based on the $someGlobalVar global.
* @global array $someGlobalVar User defined array that bla bla bla.
* @return mixed Return a result bla bla bla.
*/
I use phpDocumentor syntax so that the NetBeans IDE display inline help in the source code. All seems right in NetBeans but I'm not sure it's the way to do...
Anyone can confirm it's OK?