我第一次尝试使用rector(https://github.com/rectorphp/rector)升级我的CakePHP应用程序 . 我首先在本地开发环境中工作 .

我有点头疼了 . 例如,我创建了以下简单的php类:

<?php

class test {
    public function init( array $data) {
       return $data;
    }
}

我运行以下命令:

vendor/bin/rector process src/Model/Table/test.php --level cakephp35 --dry-run

我收到以下错误:

Class array was not found while trying to analyse it - autoloading is probably 
not configured properly.

问题在于函数中输入变量的“数组”类型声明 . 我删除它,代码通过了rector测试 .

我google了一下,找不到任何东西,这让我觉得我错过了一些非常简单的东西 . 有帮助吗?