Yii2 - 从 2.0.13 更新

Yii2 - update from 2.0.13

我使用 php composer.phar update 将 Yii2 从版本 2.0.13 更新到最新的 2.0.15.1 并且在文档中说:

You can start preparing your application for Yii 2.1 by doing the following:

Replace ::className() calls with ::class (if you’re running PHP 5.5+).
Replace usages of yii\base\InvalidParamException with yii\base\InvalidArgumentException.
Replace calls to Yii::trace() with Yii::debug().
Remove calls to yii\BaseYii::powered().
If you are using XCache or Zend data cache, those are going away in 2.1 so you might want to start looking for an alternative.

像这样

public function behaviors()
    {
        return [
            'access' => [
                'class' => AccessControl::class,
                'rules' => [
                    [
                        //
                    ]
                ]
            ],
            'verbs' => [
                'class' => VerbFilter::class,
                'actions' => [
                    'delete' => ['POST'],
                ],
            ],
        ];
    }

但是 PhpStorm 说“Class 名称常量仅在 PHP 5.5 中可用 检查源代码中使用的语言功能是否与所选语言级别相对应。 (即特征只能在 PHP 5.4 中使用)。"

我的Php是7.2.11,怎么了?

您需要在设置 -> 语言和框架 -> PHP:

中更改 PHP 版本