PHP 7.2 升级后 Yii2 升级

问题

PHP升级7.2后,Yii 2.0.12 版本由于类命名约束问题会产生如下问题:

1
Fatal error: Cannot use 'Object' as class name as it is reserved in /Users/uiste/www/my_project/mike-app/vendor/yiisoft/yii2/base/Object.php on line 77

升级方法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
➜  mike-app git:(version-update) composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
➜ mike-app git:(version-update) composer global require "fxp/composer-asset-plugin:^1.4.1"
Changed current directory to /Users/uiste/.composer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
- Updating fxp/composer-asset-plugin (v1.2.2 => v1.4.4): Downloading (100%)
Writing lock file
Generating autoload files
➜ mike-app git:(version-update) composer update yiisoft/yii2 yiisoft/yii2-composer bower-asset/jquery.inputmask
The "extra.asset-installer-paths" option is deprecated, use the "config.fxp-asset.installer-paths" option
Loading composer repositories with package information
Updating dependencies (including require-dev) GitHub API limit (60 calls/hr) is exhausted, could not fetch https://api.github.com/repos/RobinHerbots/Inputmask/contents/bower.json?ref=4.x. Create a GitHub OAuth token to go over the API rate limit. You can also wait until 2018-03-25 07:52:25 for the rate limit to reset.

Head to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+uiste+2018-03-25+0657
to retrieve a token. It will be stored in "/Users/uiste/.composer/auth.json" for future use by Composer.
Token (hidden):

浏览器打开:
https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+localhost.localdomain+2018-03-25+1945
登录github账号 生成token ,在命令行输入即可 token

继续

1
composer updated