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

'join' alias is not processed by ConsistentImplodeRector.php #8662

Closed
amfleurke opened this issue May 30, 2024 · 2 comments · Fixed by rectorphp/rector-src#5958
Closed

'join' alias is not processed by ConsistentImplodeRector.php #8662

amfleurke opened this issue May 30, 2024 · 2 comments · Fixed by rectorphp/rector-src#5958

Comments

@amfleurke
Copy link

Bug Report

Subject Details
Rector version v1.1.0

Minimal PHP Code Causing Issue

join(['a'], "string");

https://getrector.com/demo/19b79beb-de09-488e-8a60-5ec82d8a9cdf

Expected Behaviour

join("string",['a']);

Either the rector should take the alias 'join' into account, OR the php80.php should do as first line:
$rectorConfig->ruleWithConfiguration(RenameFunctionRector::class, ['join' => 'implode']);

@samsonasik
Copy link
Member

samsonasik commented May 30, 2024

@amfleurke Could you try provide a patch, first, add fixture test at

https://github.com/rectorphp/rector-src/tree/main/rules-tests/CodingStyle/Rector/FuncCall/ConsistentImplodeRector/Fixture

Then, provide a patch at:

https://github.com/rectorphp/rector-src/blob/a3ed07f8c8c0b2f7cbd78ce7711871d31bad3998/rules/CodingStyle/Rector/FuncCall/ConsistentImplodeRector.php#L73

I am on mobile, but should be something like:

-if (! $this->isName($node, 'implode')) {
+if (! $this->isNames($node, ['implode', 'join')) {
            return null;
        }

Thank you.

@amfleurke
Copy link
Author

@samsonasik thanks! I didn't get around trying to fix it myself yet.

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

Successfully merging a pull request may close this issue.

2 participants