-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Milestone
Description
Describe the bug
PHP 8.1 enum not recognized.
Code sample
<?php
enum MyEnum
{
case CONST1;
case CONST2;
}To reproduce
Just run the PHPCS with the PSR12 ruleset and the output will be something like:
FILE: /var/www/code/src/MyEnum.php
-----------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
-----------------------------------------------------------------------------------------------------------------------
5 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 4
| | (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
6 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 4
| | (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
7 | ERROR | [x] Line indented incorrectly; expected at least 4 spaces, found 0
| | (Generic.WhiteSpace.ScopeIndent.Incorrect)
-----------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------
By running the auto fix, I get:
<?php
enum MyEnum
{
case CONST1;
case CONST2;
}Expected behavior
The following code should cause no CS error:
<?php
enum MyEnum
{
case CONST1;
case CONST2;
}Versions (please complete the following information):
- OS: Docker on MacOS (image tag
php:8.1.0RC5-cli-alpine3.14) - PHP: 8.1 RC5
- PHPCS: 3.6.1
- Standard: PSR12
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels