2014-05-16 53 views
0

聲明類之外是否可以記錄方法,屬性等?聲明之外的類文檔

<?php 

// lib/classa.php 

class ClassA { 
    public function __call($method, $args) 
    { 
    if ($method == 'testA') 
     return $method; 
    else if ($method == 'testB') 
     return $method; 
    } 
} 

正如您在上面看到的那樣,類有一些未公開的功能,IDE無法得到任何注意。

<?php 

// app/index.php 

/** 
* @method string ClassA::testA() 
* @method string ClassA::testB() 
*/ 

$classa = new ClassA(); 
classa->testA(); 
#  ^
#  | 
#  \_____Code suggestions here 

我以任何可能性暗示IDE關於缺失功能的可能性。它可以幫助我解決在框架中生成但仍在實際項目中使用的庫或文檔類中丟失的文檔。

回答

0

如果使用phpdoc,這是不可能的。你應該閱讀約docblock@method用另一種方式:

/** 
* @method string testA() 
* @method string testB() 
*/ 
class ClassA { 
    public function __call($method, $args) 
    { 
    if ($method == 'testA') 
     return $method; 
    else if ($method == 'testB') 
     return $method; 
    } 
} 

你有兩個選擇:擴展庫類和記錄自己的類,或者更好的:圖書館的發展和文檔庫做出貢獻。

相關問題