-
-
Notifications
You must be signed in to change notification settings - Fork 742
Description
Bug Report
I'm not sure how the rule should handle this case. If you try to refactor implode('string a', 'string b' ) the rule will not change the order of the arguments, that is fine, the code will throw an error anyway.
But in my case I have a variable as second argument: implode(' ' . $separator, $anArray), $anArray is an array but due to some errors in annotations phpstan thinks that it is a string, so the rule is changing the order of the arguments and causing errors. I know that if I fix the problem with the annotations the rule work as expected.
So, I was thinking that the correct behavior for this case it's to not change the order of the arguments since it's something unexpected, but I'm not sure.
I will fix the annotations in my code, this will not be a problem for me. But I wanted to report this to see if it's a case that needs to be handled.
| Subject | Details |
|---|---|
| Rector version | last dev-main |
| Installed as | composer dependency |
Minimal PHP Code Causing Issue
See https://getrector.com/demo/ec054f63-0f4e-489d-a3da-fa87581814f0
<?php
final class DemoFile
{
public function run()
{
implode('|' . ' ', 'should not be changed?');
}
}Responsible rules
ConsistentImplodeRector
Expected Behavior
The order of the arguments should not change.