Skip to content

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

@aik099

Description

@aik099

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions