Remove operation with 1 and 0, that have no effect on the value
class SomeClass
{
public function run()
{
- $value = 5 * 1;
- $value = 5 + 0;
+ $value = 5;
+ $value = 5;
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\Plus\RemoveDeadZeroAndOneOperationRector;
return RectorConfig::configure()
->withRules([
RemoveDeadZeroAndOneOperationRector::class,
]);