Reduce always false in a if ( || ) condition
class SomeClass
{
public function run(int $number)
{
- if (! is_int($number) || $number > 50) {
+ if ($number > 50) {
return 'yes';
}
return 'no';
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\If_\ReduceAlwaysFalseIfOrRector;
return RectorConfig::configure()
->withRules([
ReduceAlwaysFalseIfOrRector::class,
]);