-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
Describe the bug
PHP 8.1 enum recognised as goto statement
Code sample
enum Status: int
{
case ACTIVE = 1;
case ARCHIVE = 2;
}Custom ruleset
<?xml version="1.0"?>
<ruleset name="mine"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd"
>
<rule ref="PSR12"/>
<rule ref="Generic.PHP.DiscourageGoto"/>
</ruleset>To reproduce
Steps to reproduce the behavior:
- Create a file called
test.phpwith the code sample above... - Run
phpcs test.php ... - See error message displayed
----------------------------------------------------------------------
FOUND 5 ERRORS AND 1 WARNING AFFECTING 5 LINES
----------------------------------------------------------------------
9 | WARNING | [ ] Use of the GOTO language construct is
| | discouraged
| | (Generic.PHP.DiscourageGoto.Found)
12 | ERROR | [x] Line indented incorrectly; expected 0 spaces,
| | found 4
| | (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
14 | ERROR | [x] Line indented incorrectly; expected 0 spaces,
| | found 4
| | (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
16 | ERROR | [x] Line indented incorrectly; expected 0 spaces,
| | found 4
| | (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
17 | ERROR | [x] Expected 1 blank line at end of file; 2 found
| | (PSR2.Files.EndFileNewline.TooMany)
17 | ERROR | [x] Line indented incorrectly; expected at least 4
| | spaces, found 0
| | (Generic.WhiteSpace.ScopeIndent.Incorrect)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
Expected behavior
no errors
Versions (please complete the following information):
- OS: linux mint
- PHP: 8.1
- PHPCS: latest (3.6.2)
- Standard: PSR12
Additional context
the reported indentation problems already have a closed issue here: #3474
Metadata
Metadata
Assignees
Labels
No labels