DowngradeArrayFindKeyRector
Downgrade array_find_key() to foreach loop
-$found = array_find_key($animals, fn($animal) => str_starts_with($animal, 'c'));
+$found = null;
+foreach ($animals as $idx => $animal) {
+ if (str_starts_with($animal, 'c')) {
+ $found = $idx;
+ break;
+ }
+}
Configure your rector.php:
<?php
use Rector\Config\RectorConfig;
use Rector\DowngradePhp84\Rector\Expression\DowngradeArrayFindKeyRector;
return RectorConfig::configure()
->withRules([
DowngradeArrayFindKeyRector::class,
]);