首页 > 解决方案 > CakePHP 通过 Rector 升级,具有输入类型数组声明的函数

问题描述

我第一次尝试使用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.

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

我用谷歌搜索,找不到任何东西,这让我觉得我错过了一些非常简单的东西。有什么帮助吗?

标签: cakephp-3.5phpstan

解决方案


推荐阅读