Skip to content

Commit 10d5cce

Browse files
committed
PHP 8.1: PSR1/SideEffects - Added support for enums
1 parent 7beba37 commit 10d5cce

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/Standards/PSR1/Sniffs/Files/SideEffectsSniff.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ private function searchForConflict($phpcsFile, $start, $end, $tokens)
8282
T_CLASS => T_CLASS,
8383
T_INTERFACE => T_INTERFACE,
8484
T_TRAIT => T_TRAIT,
85+
T_ENUM => T_ENUM,
8586
T_FUNCTION => T_FUNCTION,
8687
];
8788

src/Standards/PSR1/Tests/Files/SideEffectsUnitTest.1.inc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const CONSTANT2 = 2;
66

77
use Something;
88
use SomethingElse;
9+
use function interface_exists;
910

1011
declare(ticks=1);
1112

@@ -63,6 +64,11 @@ if (!interface_exists('MyInterface')) {
6364
interface MyInterface {}
6465
}
6566

67+
if (!interface_exists('MyEnum')) {
68+
// Define an enum.
69+
enum MyEnum {}
70+
}
71+
6672
#[\Attribute]
6773
namespace {
6874
class A {}

0 commit comments

Comments
 (0)