Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Squiz.Commenting.FunctionComment sniff doesn't allow description in @return tag #1015

Closed
aik099 opened this issue May 21, 2016 · 1 comment

Comments

@aik099
Copy link
Contributor

aik099 commented May 21, 2016

Code example:

class ClassName {

    /**
     * (PHP 5 &gt;= 5.0.0)<br/>
     * Move forward to next element
     *
     * @return void Any returned value is ignored.
     * @link   http://php.net/manual/en/iterator.next.php
     */
    public function next()
    {
        $this->offset++;
    }

}

I'm getting Squiz.Commenting.FunctionComment.InvalidNoReturn error (message Function return type is not void, but function has no return statement) because @return statement has a description after it. This is allowed in DocBlocks - https://www.phpdoc.org/docs/latest/references/phpdoc/tags/return.html .

I think, that we should explode @return tag content into 2 parts by space, since spaces aren't allowed in returned type itself and only check 1st part as returned type.

Related Issue: #1018

@gsherwood gsherwood changed the title The "Squiz.Commenting.FunctionComment" doesn't allow description in "@return" tag The Squiz.Commenting.FunctionComment sniff doesn't allow description in @return tag May 24, 2016
gsherwood added a commit that referenced this issue May 24, 2016
@gsherwood
Copy link
Member

Thanks for the report and the fix + tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants