cakephp / upgrade

Upgrade tools for CakePHP meant to facilitate migrating from one version of the framework to another
MIT License
110 stars 60 forks source link

`OptionsArrayToNamedParametersRector` bug if named params already exist #241

Closed LordSimal closed 1 year ago

LordSimal commented 1 year ago

I encountered this issue executing

bin/cake upgrade rector --rules cakephp50 /Users/kevinpfeifer/Documents/Sunlime/alfred/src

after I already converted some ->find() and ->get() calls to named params.

3) ../../../Sunlime/alfred/src/Queue/Task/
CheckLoginDataTask.php:38

    ---------- begin diff ----------
@@ @@
         $ftpLoginDataTable = $this->fetchTable('FtpLoginData');
         try {
             /** @var \App\Model\Entity\FtpLoginData $loginDataEntry */
-            $loginDataEntry = $ftpLoginDataTable->get($ftpLoginDataID, contain: [
-                'FtpDomains' => [
-                    'ContentCategories' => ['ParentContentCategory'],
-                    'MetaCategories' => ['ParentMetaCategory'],
-                    'Deployments' => ['Vpns'],
-                ],
+            $loginDataEntry = $ftpLoginDataTable->get($ftpLoginDataID, FtpDomains: [
+                'ContentCategories' => ['ParentContentCategory'],
+                'MetaCategories' => ['ParentMetaCategory'],
+                'Deployments' => ['Vpns'],
             ]);

As you can see it doesn't detect already present named params.