implode gets the array first and the separator second

tx0/php:implode-argument-orderdefaulterrorreliability/api-misusedepth fastbug

What it finds

implode($parts, ', '): the separator comes first. The reversed order was accepted for a long time and was removed in PHP 8, where the call fails.

From the rule's source, implode_argument_order.rs.

Example from the rule's tests
<?phpfunction join_all($parts){    $a = implode($parts, ', ');tx0 reports: implode gets the separator as its second argument    $b = implode(', ', $parts);    $c = join(['x', 'y'], '-');tx0 reports: join gets the separator as its second argument    return $a . $b . $c;}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:

tx0.toml
[rules]
"tx0/php:implode-argument-order" = "off"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/php:implode-argument-order] reason="..."

tx0 explain tx0/php:implode-argument-order shows the same in the terminal. Found a false positive? Report it.