2011-09-01 38 views
1

我发现这个问题已被回答,但它并没有解决我的问题: Aptana Scriptdoc doesn't show up in Code Assist集锦3 ScriptDoc - @return没有代码工作,协助

使用PHP相当于他们为榜样的...

/** 
* Gets the current foo 
* @param {String} $fooId The unique identifier for the foo. 
* @return {Object} Returns the current foo. 
*/ 
public function getFoo($fooId) { 
    return $bar[$fooId]; 
} 

然而,所提供的documenation看起来像这样(包括额外的结局大括号):

getFoo($fooId) 
Gets the current foo 

@param String $fooId The unique identifier for the foo. 
@return Object} 
Resolved return types: Object} 

请让我知道我做错了。

谢谢!

回答

2

@return类型不应该用大括号包裹。

您的文档应该是这样的:

/** 
* Gets the current foo 
* @param String $fooId The unique identifier for the foo. 
* @return Object Returns the current foo. 
*/ 
public function getFoo($fooId) { 
    return $bar[$fooId]; 
} 

返回类型的解析如下PHPDoc @return rules

这也意味着你可以有一个混合返回类型,它会给你多种类型的代码辅助建议。

例如:

/** 
* @return MyClass|PDO doc doc doc 
*/ 

干杯