Skip to content

Latest commit

 

History

History
45 lines (33 loc) · 854 Bytes

rector-rules.md

File metadata and controls

45 lines (33 loc) · 854 Bytes

2 Rules Overview

ToNativeImplementationRector

Convert usages of BenSampo\Enum\Enum to native PHP enums

🔧 configure it!

-/**
- * @method static static ADMIN()
- * @method static static MEMBER()
- *
- * @extends Enum<int>
- */
-class UserType extends Enum
+enum UserType : int
 {
-    const ADMIN = 1;
-    const MEMBER = 2;
+    case ADMIN = 1;
+    case MEMBER = 2;
 }

ToNativeUsagesRector

Convert usages of BenSampo\Enum\Enum to native PHP enums

🔧 configure it!

-$user = UserType::ADMIN();
-$user->is(UserType::ADMIN);
+$user = UserType::ADMIN;
+$user === UserType::ADMIN;