ImplodeArgumentsOrder
info on by default quick-fixGroup: Code style · PhpStorm name: ImplodeArgumentsOrderInspection
implode() historically accepted its separator in either position; passing the pieces first and the separator second is deprecated (7.4) and removed (8.0). When the second argument is clearly the separator (a string literal), the arguments are swapped.
Example
php
<?php
$csv = implode($cells, ';');
$path = \implode( $segments , "/" );
$ok1 = implode(' | ', $labels);
$ok2 = implode($labels, $sep);
$ok3 = implode($labels);
$ok4 = join($labels, '-');php
<?php
$csv = implode(';', $cells);
$path = \implode("/", $segments);
$ok1 = implode(' | ', $labels);
$ok2 = implode($labels, $sep);
$ok3 = implode($labels);
$ok4 = join($labels, '-');Reported:
- line 3: Pass the separator as the first argument of implode().
- line 4: Pass the separator as the first argument of implode().
Options
| Option | Type | Default | Effect |
|---|
Configure
In custos.json:
json
{
"rules": {
"ImplodeArgumentsOrder": {
"enabled": false
}
}
}Suppress
Before the statement or declaration (or the first statement of the file), either of:
php
// @custos-ignore ImplodeArgumentsOrder
/**
* @noinspection ImplodeArgumentsOrderInspection
*/