Skip to content

[SOLID] Add RepeatedLiteralToClassConstantRector#3325

Merged
TomasVotruba merged 5 commits intomasterfrom
solid-const
May 6, 2020
Merged

[SOLID] Add RepeatedLiteralToClassConstantRector#3325
TomasVotruba merged 5 commits intomasterfrom
solid-const

Conversation

@TomasVotruba
Copy link
Copy Markdown
Member

@TomasVotruba TomasVotruba commented May 6, 2020

Closes #3303

 class SomeClass
 {
+    /**
+     * @var string
+     */
+    private const REQUIRES = 'requires';

     public function run($key, $items)
     {
-        if ($key === 'requires') {
+        if ($key === self::REQUIRES) {
-            return $items['requires'];
+            return $items[self::REQUIRES];
         }
     }
 }

@TomasVotruba TomasVotruba force-pushed the solid-const branch 8 times, most recently from 8f36795 to 0a36702 Compare May 6, 2020 21:32
@TomasVotruba TomasVotruba merged commit e0f2366 into master May 6, 2020
@TomasVotruba TomasVotruba deleted the solid-const branch May 6, 2020 22:05
TomasVotruba added a commit that referenced this pull request Jan 31, 2023
rectorphp/rector-src@033b0c2 Fix nested extends pattern in AddReturnTypeDeclarationBasedOnParentClassMethodRector (#3325)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SOLID] Define constants instead of literals

1 participant