PHP_CodeSniffer icon indicating copy to clipboard operation
PHP_CodeSniffer copied to clipboard

Fix `Squiz.Commenting.FunctionComment.InvalidNoReturn` false positive when return type is `never`

Open axlon opened this issue 3 years ago • 0 comments

The Squiz.Commenting.FunctionComment.InvalidNoReturn causes false positives when it encounters the never return type.

Tested this locally with:

<rule ref="Squiz.Commenting.FunctionComment.InvalidNoReturn"/>
/**
 * @return never
 */
private function foo()
{
    throw new \RuntimeException('This method never returns');
}

axlon avatar Nov 21 '22 13:11 axlon