Function implode can be called in 3 ways, one - not documented - which should be fixed:
<?php
-implode($pieces , '');
+implode("", $pieces );
and two that are correct:
<?php
implode("", $pieces);
implode($pieces);
How should we handle these 2 signatures? I could not find any conclusive reason one is better than the other - should the fixer have an option empty_string with values ensure and remove? If so what would be the default (and why?) and would that default be our default here?
Or maybe one signature is somehow better and should be recommended?
:+1: for fixing to implode("", $pieces); , as it is more explicit and used in same way as the counter part explode
Maybe implode($pieces , '') will be deprecated in 7.4:
https://wiki.php.net/rfc/deprecations_php_7_4
The following are still Work-In-Progress and ideas:
- Unify parameter order for implode() to match explode()
The implode($pieces , '') case is obvious how to handle - I'm asking how to approach 2 correct, documented usages.
I agree to @SpacePossum, we should fix it to the explicit one implode('', $pieces).
I would not add a configuration option for it, until it is explicitly demanded by someone who wants to use implode($pieces).
Most helpful comment
It seems to be symfony standard to use
implode('', $pieces)instead ofimplode($pieces).