tree-sitter-phpdoc icon indicating copy to clipboard operation
tree-sitter-phpdoc copied to clipboard

we require return types in @method tags, but phpstan does not

Open claytonrcarter opened this issue 1 year ago • 0 comments

Noticed while using Zed w/ this docblock:

/**
 * @method getSelectorContents(string $selector)
 * @method getSelectorAttribute(string $selector, string $attribute)
 * @method getTrimmedString(string $string)
 */

phpstan does fine with this, but the highlighting was messed up in Zed. The issue is that we are requiring a return type for @method, so the above resulted in a parse error, but phpstan seems to not care if one exists or not.

This snippet was colored correctly:

/**
 * @method DOMNodeList getSelectorContents(string $selector)
 * @method string getSelectorAttribute(string $selector, string $attribute)
 * @method string getTrimmedString(string $string)
 */

Suggestion: make return type optional to match behavior of phpstan.

claytonrcarter avatar Aug 12 '24 15:08 claytonrcarter