slevomat / coding-standard

Slevomat Coding Standard for PHP_CodeSniffer provides many useful sniffs
MIT License
1.4k stars 178 forks source link

Traits in enums not listed like traits in classes. #1369

Closed mikebronner closed 2 years ago

mikebronner commented 2 years ago

When including traits in enums, I'm seeing the following warning:

<?php

declare(strict_types=1);

namespace App\Definitions;

use App\Traits\ValueBasedOptions;

enum EmploymentBasis: string
{
    use ValueBasedOptions;

    case FullTime = "Full-Time";
    case PartTime = "Part-Time";
}
Screen Shot 2022-05-24 at 3 50 52 PM
Expected 1 line before first use statement, found 0.
(SlevomatCodingStandard.Namespaces.UseSpacing.IncorrectLinesCountBeforeFirstUse)phpcs

I was expecting use statements in enums to be treated just like use statements in classes. Thanks!

kukulich commented 2 years ago

There’s no support for PHP 8.1 currently. You can try unstable branch “php81”.

mikebronner commented 2 years ago

Thanks for the work-around, branch php81 appears to not have the above issue.

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.