从5.2升到5.3,在composer.json
文件直接修改版本号"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.3.*",
"predis/predis": "^1.1",
"guzzlehttp/guzzle": "^6.3"
},
然后在bootstrap/autoload.php中加入
$compiledPath = __DIR__.'/cache/compiled.php';
if (file_exists($compiledPath)) {
require $compiledPath;
}
修改完后更新composer
composer update
此时,报错了
[ErrorException]
Declaration of App\Providers\EventServiceProvider::boot(Illuminate\Contracts\Events\Dispatcher
$events) should be compatible with Illuminate\Foundation\Support\Providers\EventServiceProvider
::boot()
这是因为EventServiceProvider::boot() 的参数与其重写的boot()参数不一致,只需把App\Providers\EventServiceProvider::boot的参数删除或注释掉
public function boot(/*DispatcherContract $events*/)
{
parent::boot(/*$events*/);
//
}
这个改完后再update还会报一个异常
[ErrorException]
Declaration of App\Providers\RouteServiceProvider::boot(Illuminate\Routing\Router $router) shou
ld be compatible with Illuminate\Foundation\Support\Providers\RouteServiceProvider::boot()
解决办法一样的。
当修改完这两个方法再update就OK了。