Change ternary with false to if and explicit call
final class SomeClass
{
public function run($value, $someMethod)
{
- $value ? $someMethod->call($value) : false;
+ if ($value) {
+ $someMethod->call($value);
+ }
}
}
Configure your rector.php
:
<?php
use Rector\CodeQuality\Rector\Expression\TernaryFalseExpressionToIfRector;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withRules([
TernaryFalseExpressionToIfRector::class,
]);