Symfony-coding-standard icon indicating copy to clipboard operation
Symfony-coding-standard copied to clipboard

[php 8.1] Errors found in enum

Open lobodol opened this issue 3 years ago • 2 comments

Hello there,

I'm working on a Symfony 5.4 project with php 8.1. I declared an enum type as following:

enum Status: string
{
    case Open = 'open';
    case Archived = 'archived';
}

When running PHPCS, I got the following errors:

FOUND 3 ERRORS AFFECTING 3 LINES
---------------------------------------------------------------------------------
 15 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 4
 20 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 4
 21 | ERROR | [x] Line indented incorrectly; expected at least 4 spaces, found 0
---------------------------------------------------------------------------------

When running PHPCBF, here is how it fixes the errors:

enum Status: string
{
case Open = 'open';
case Archived = 'archived';
    }

As you can see, case statements have no indentation, whereas the closing bracket has 4 spaces.

It seems to be bug to me.

What do you think about it?

lobodol avatar Feb 08 '22 10:02 lobodol

Needs to wait for a new PHPCS release with https://github.com/squizlabs/PHP_CodeSniffer/issues/3479 closed.

mmoll avatar Feb 08 '22 10:02 mmoll

related to this issue which hasn't been tagged yet

wickedOne avatar Feb 08 '22 10:02 wickedOne