Use Str::startsWith() or Str::endsWith() instead of substr() === $str
-if (substr($str, 0, 3) === 'foo') {
+if (Str::startsWith($str, 'foo')) {
// do something
}
Configure your rector.php
:
<?php
use RectorLaravel\Rector\Expr\SubStrToStartsWithOrEndsWithStaticMethodCallRector\SubStrToStartsWithOrEndsWithStaticMethodCallRector;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withRules([
SubStrToStartsWithOrEndsWithStaticMethodCallRector::class,
]);