Skip to content

Squiz.Commenting.FunctionComment.ThrowsNoFullStop false positive when one line @throws #3503

Closed
@vaclavvanik

Description

@vaclavvanik

Describe the bug
Squiz.Commenting.FunctionComment sniff throws ThrowsNoFullStop on one line php doc comment with @throws annotation.

Code sample

<?php

declare(strict_types=1);

namespace My;

use Exception;

/** @throws Exception if any other error occurs. */
function foo(string $string): string
{
    return $string;
}

To reproduce
Steps to reproduce the behavior:

  1. Create a file called test.php with the code sample above...
  2. Run phpcs test.php ...
  3. See error message displayed
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------
  9 | ERROR   | @throws tag comment must end with a full stop
    |         | (Squiz.Commenting.FunctionComment.ThrowsNoFullStop)

Expected behavior
No error :-)

Versions (please complete the following information):

  • OS: Ubuntu 18.04
  • PHP: 8.0
  • PHPCS: 3.6.1
  • Standard: Squiz

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions