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

Low - RenameForeachValueVariableToMatchExprVariableRector is removing too much "s" letter #6796

Closed
cavo789 opened this issue Nov 9, 2021 · 4 comments
Labels

Comments

@cavo789
Copy link

cavo789 commented Nov 9, 2021

Bug Report

Subject Details
Rector version 07736c1ab4d45d348d5054625499f10f97d671be

Minimal PHP Code Causing Issue

@@ @@
-        foreach ($this->hasFilters as $hasFilter) {
-            $response->assertFiltersInclude($hasFilter);
+        foreach ($this->hasFilters as $haFilter) {
+            $response->assertFiltersInclude($haFilter);
         }
     }

Applied rules:

  • RenameForeachValueVariableToMatchExprVariableRector

Expected Behaviour

As you can see in the example here above; the new expected variable name should be $hasFilter i.e. the final s should be removed and only the final one.

(Once again, many thanks to make Rector so amazing)

@cavo789 cavo789 added the bug label Nov 9, 2021
@TomasVotruba
Copy link
Member

Hi, thanks for reporting.

Could you add test fixture into responsible class? Here it is:
https://github.com/rectorphp/rector-src/blob/main/tests/Naming/ExpectedNameResolver/InflectorSingularResolverTest.php

What has to be changed there?

@cavo789
Copy link
Author

cavo789 commented Nov 9, 2021

Thanks Tomas, I'll try to understand what I need to do (if you've some sample, don't hesitate). I'll do it asap (probably tomorrow)

@samsonasik
Copy link
Member

fixed at rectorphp/rector-src#1222

@cavo789
Copy link
Author

cavo789 commented Nov 13, 2021

That's really great... I'm enjoying a long week-end, my idea was to look what I can do Monday without knowing exactly how to start... That's nice and cool that it's already solved.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants