Inline just in time array dim fetch assigns to direct return
function getPerson()
{
- $person = [];
- $person['name'] = 'Timmy';
- $person['surname'] = 'Back';
-
- return $person;
+ return [
+ 'name' => 'Timmy',
+ 'surname' => 'Back',
+ ];
}
Configure your rector.php
:
<?php
use Rector\CodeQuality\Rector\ClassMethod\InlineArrayReturnAssignRector;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withRules([
InlineArrayReturnAssignRector::class,
]);