final class DemoFile
{
public function run(string $param, string $param2)
{
if (strpos(strtolower($param), $param2) !== false) {
return 'hello';
}
return 'world';
}
public function runI(string $param, string $param2)
{
if (stripos($param, $param2) !== false) {
return 'hello';
}
return 'world';
}
}
$demo_file = new DemoFile();
echo $demo_file->run('Abc', 'aBc') . PHP_EOL;
echo $demo_file->runI('Abc', 'aBc');
This will result in
world
hello
Expected Behaviour
Using strpos with strtolower is not the same as stripos. Therefore changes done by SimplifyStrposLowerRector are not correct in many cases (= all cases where the 2nd argument may contain any non-lowercase characters)
Bug Report
SimplifyStrposLowerRector underlying assumption is wrong, and the rule should be deprecated https://getrector.com/demo/fbdf29d5-c428-498f-aead-30ad8e600f61
Minimal PHP Code Causing Issue
This will result in
Expected Behaviour
Using strpos with strtolower is not the same as stripos. Therefore changes done by SimplifyStrposLowerRector are not correct in many cases (= all cases where the 2nd argument may contain any non-lowercase characters)