Use ===/!== over ==/!=, it values have the same type
class SomeClass
{
public function run(int $firstValue, int $secondValue)
{
- $isSame = $firstValue == $secondValue;
- $isDiffernt = $firstValue != $secondValue;
+ $isSame = $firstValue === $secondValue;
+ $isDiffernt = $firstValue !== $secondValue;
}
}
Configure your rector.php
:
<?php
use Rector\CodeQuality\Rector\Equal\UseIdenticalOverEqualWithSameTypeRector;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withRules([
UseIdenticalOverEqualWithSameTypeRector::class,
]);