开发者

Aptana 3 ScriptDoc - @Return not working in Code Assist

I found this question that had been answered, but it didn't s开发者_如何学运维olve my problem: Aptana Scriptdoc doesn't show up in Code Assist

Using the PHP equivalent of their example...

/**
 * 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];
}

However, the documenation provided looks like this (extra ending braces included):

getFoo($fooId)
Gets the current foo

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

Please let me know what I'm doing wrong.

Thanks!


The @return type should not be wrapped with curly brackets.

Your doc should look like this:

/**
 * 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];
}

The parsing of the return type follows the PHPDoc @return rules.

This also means you can have a mixed return type, which will give you code-assist suggestions from multiple types.

For example:

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

Cheers

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜