Use anonymous functions instead of deprecated create_function()
class ClassWithCreateFunction
{
public function run()
{
- $callable = create_function('$matches', "return '$delimiter' . strtolower(\$matches[1]);");
+ $callable = function($matches) use ($delimiter) {
+ return $delimiter . strtolower($matches[1]);
+ };
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\Php72\Rector\FuncCall\CreateFunctionToAnonymousFunctionRector;
return RectorConfig::configure()
->withRules([
CreateFunctionToAnonymousFunctionRector::class,
]);