Changes strlen comparison to 0 to direct empty string compare
class SomeClass
{
public function run(string $value)
{
- $empty = strlen($value) === 0;
+ $empty = $value === '';
}
}
Configure your rector.php
:
<?php
use Rector\CodeQuality\Rector\Identical\StrlenZeroToIdenticalEmptyStringRector;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withRules([
StrlenZeroToIdenticalEmptyStringRector::class,
]);