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

"System error: "PhpParser\Node\Identifier::__construct(): Argument #1 ($name) must be of type string, null given #289

Closed zegert closed 3 days ago

zegert commented 3 weeks ago

When i run the command: bin/cake upgrade rector --dry-run --rules cakephp50 {path}

[ERROR] Could not process                                                      
         "/home/zegert/Netwerk/src/Controller/Admin/GrantedJobsController.php"  
         file, due to:                                                          
         "System error: "PhpParser\Node\Identifier::__construct(): Argument #1  

   ($name) must be of type string, null given, called in                  
         src/Rector/Rector/MethodCall/OptionsArrayToNamedParametersRector.php123
         "                                                                      
         Run Rector with "--debug" option and post the report here: https://github.com/rectorphp/rector/issues/new". On line: 21

The --debug doesn't seem to be working:

bin/cake upgrade rector --debug --rules cakephp50 /home/zegert/Netwerk/src

gives:

Error: Unknown option 'debug'.

What could this be. I'm on 4.5 and the depr. warnings are all gone and i would like to upgrade to CakePHP5.

If you need more information about my setup, please leave a message.

LordSimal commented 3 weeks ago

There seems to be something in your src/Controller/Admin/GrantedJobsController.php which can't get parsed by PhpParser.

Something related to the options array being converted to named parameters.

Do you have something like $articles->find('all', ['conditions' => ['Articles.title' => $title]]) in there where the array doesn't have a key - value pair?

zegert commented 3 days ago

Thanks, that points me in the right direction.