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