You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Squiz.Commenting.FunctionComment doesn't seem to support PHP 8.1 never return type.
Code sample
<?php/** * @return never */functionredirect(): never
{
header('Location: /');
exit();
}
Custom ruleset
<?xml version="1.0"?>
<rulesetxmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<description>Coding standard.</description>
<argname="tab-width"value="4"/>
<ruleref="PSR12" />
<!-- PHPDoc and type hinting sniffs -->
<ruleref="Squiz.Commenting.FunctionComment" />
<exclude-pattern>vendor/*</exclude-pattern>
</ruleset>
To reproduce
Steps to reproduce the behavior:
Create a file called test.php with the code sample above.
Create a file called phpcs.xml with the custom ruleset above.
Run phpcs test.php
See error message displayed
FILE: test.php
------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------
4 | ERROR | Function return type is not void, but function has no return statement
------------------------------------------------------------------------------------
Time: 34ms; Memory: 6MB
Expected behavior
never return type is detected and no error is shown.
Versions (please complete the following information):
OS: Ubuntu 22.04 LTS
PHP: 8.1
PHPCS: 3.7.2
Standard: Squiz
The text was updated successfully, but these errors were encountered:
Describe the bug
Squiz.Commenting.FunctionComment
doesn't seem to support PHP 8.1never
return type.Code sample
Custom ruleset
To reproduce
Steps to reproduce the behavior:
test.php
with the code sample above.phpcs.xml
with the custom ruleset above.phpcs test.php
Expected behavior
never
return type is detected and no error is shown.Versions (please complete the following information):
The text was updated successfully, but these errors were encountered: