Skip to content

PHP notice in Squiz.Commenting.FunctionComment when checking malformed @throws comment #485

@aik099

Description

@aik099

When having DocBlock of function like this:

/**  * Test  *  * @return array  * @throws E   */

Note space after @throws E, then "Squiz.Commenting.FunctionComment" sniff is triggering Uninitialized string offset: 0 notice because in that case comment is text is matched via regexp and is an empty string. Then check for 1st char is a letter is invoked in 205 line and that's triggers a notice.

I think that } else if ($comment === null) { in line 187 in fact should be } else if (empty($comment) === true) { to catch both undefined and empty comments.

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