Change helper functions to str_starts_with()
class SomeClass
{
public function run()
{
- $isMatch = substr($haystack, 0, strlen($needle)) === $needle;
+ $isMatch = str_starts_with($haystack, $needle);
- $isNotMatch = substr($haystack, 0, strlen($needle)) !== $needle;
+ $isNotMatch = ! str_starts_with($haystack, $needle);
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\Php80\Rector\Identical\StrStartsWithRector;
return RectorConfig::configure()
->withRules([
StrStartsWithRector::class,
]);