Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SOLID] Add RepeatedLiteralToClassConstantRector #3325

Merged
merged 5 commits into from
May 6, 2020
Merged

Conversation

TomasVotruba
Copy link
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