AddParamFromDimFetchKeyUseRector

Add method param type based on use in array dim fetch of known keys

 final class SomeClass
 {
-    public function get($key)
+    public function get(string $key)
     {
         $data = [
             'name' => 'John',
             'age' => 30,
         ];

         return $data[$key];
     }
 }

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\ClassMethod\AddParamFromDimFetchKeyUseRector;

return RectorConfig::configure()
    ->withRules([
        AddParamFromDimFetchKeyUseRector::class,
    ]);