第一天我使用phpDocumentor,迄今爲止這麼好,但我有一個問題,我沒有抓住手冊......全局變量的文檔。phpDocumentor @global和@name問題
我怎麼會記錄此代碼,如果:
- $ someGlobalVar是在類的PHP文件中未 decalren(它甚至可以undelared)。
- $ someGlobalVar聲明如下:$ someGlobalVar = array();(不像phpDocumentor手冊中那樣使用超全局數組)。
的PHP代碼:
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
{
//...
}
}
}
編輯:我想要做的文檔中,這些全局的手動節目,但我不知道如何/在哪裏把@global和@name標籤。
編輯2:我結束了使用下面的代碼片斷只是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.
*/
我使用phpDocumentor的語法,這樣,在源代碼中的NetBeans IDE顯示在線幫助。在NetBeans中似乎都是正確的,但我不確定這是做什麼的...
任何人都可以確認它是否正常?
好吧,**我**將解決這個問題,因爲不使用全局變量:)但我不認爲這就是你想要的答案。 – 2010-01-29 21:15:57
嘿嘿真的,但在我的情況下,我必須記錄做了什麼:) – AlexV 2010-01-29 21:26:06
對於任何人在Google搜索時遇到問題,[此線程似乎有一個詳細的答案。](http://stackoverflow.com/questions/12163292/phpdoc-does-not-scall-to-recognisation-global-variables-in-output-what-am-i-doing-wr) – Byson 2014-11-24 12:09:37