Narrow ternary with implode and empty string to direct implode, as same result
class SomeClass
{
public function run(array $values)
{
- return $values === [] ? '' : implode(',', $values);
+ return implode(',', $values);
}
}
Configure your rector.php
:
<?php
use Rector\CodeQuality\Rector\Ternary\TernaryImplodeToImplodeRector;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withRules([
TernaryImplodeToImplodeRector::class,
]);