ContainerArrayAccessToMethodCallRector
Change array access on the container to the matching method call, as the contract does not extend ArrayAccess
-$container['foo'];
-$container['foo'] = 'Foo';
-isset($container['foo']);
+$container->make('foo');
+$container->bind('foo', 'Foo');
+$container->bound('foo');
Configure your rector.php:
<?php
use RectorLaravel\Rector\ArrayDimFetch\ContainerArrayAccessToMethodCallRector;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withRules([
ContainerArrayAccessToMethodCallRector::class,
]);