PHP工匠突然不起作用

前端之家收集整理的这篇文章主要介绍了PHP工匠突然不起作用前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我已经开始学习Laravel了.到现在为止,一切都很顺利.我正在关注本教程,我坚持使用 episode 7.

问题是我不能再开工匠了.我已经尝试安装修补程序,我可能更新了工匠,所以我最终没有工匠和修补程序.我正在使用Linux Ubuntu 12.04 LTS.我通过命令行安装了一切.之后,我试图运行:

PHP artisan –version

发生以下问题:

[ErrorException]
Declaration of App\Providers\EventServiceProvider::boot() should be
compati ble with
Illuminate\Foundation\Support\Providers\EventServiceProvider::boot
()

这是我的文件应用程序/ Providers / EventServiceProvider.PHP的样子:

<?PHP

namespace App\Providers;

use Illuminate\Contracts\Events\Dispatcher as DispatcherContract;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;

class EventServiceProvider extends ServiceProvider
{
    /**
     * The event listener mappings for the application.
     *
     * @var array
     */
    protected $listen = [
        'App\Events\SomeEvent' => [
            'App\Listeners\EventListener',],];

    /**
     * Register any other events for your application.
     *
     * @param  \Illuminate\Contracts\Events\Dispatcher  $events
     * @return void
     */
    public function boot(DispatcherContract $events)
    {
        parent::boot($events);

        //
    }
}

我使用Laravel 5.2和我的composer.json看起来像这样:

"PHP": ">=5.5.9","laravel/framework": "5.2.*","doctrine/dbal": "^2.6@dev","vluzrmos/tinker": "dev-master","moon/artisan": "dev-master"

我在这里看到类似的问题,例如:

https://laracasts.com/discuss/channels/general-discussion/l5-composer-update-ends-with-an-error-suddenly

https://laracasts.com/discuss/channels/laravel/event-service-provider-in-package

但是从来没有直接给出答案,实际上我不明白如何解决这个问题?我需要直接回答,因为我是Laravel的新手.可以使用Linux命令行轻松更新工匠,以便它能再次工作吗?

显然,新的boot()方法没有任何参数.您必须对三个提供商应用一些更改.
/**
      * Register any other events for your application.
      *
-     * @param  \Illuminate\Contracts\Events\Dispatcher  $events
      * @return void
      */
-    public function boot(DispatcherContract $events)
+    public function boot()
     {
-        parent::boot($events);
+        parent::boot();

         //
     }

查看此提交的完整列表更改.

https://github.com/laravel/laravel/commit/2b05ce3b054593f7622c1be6c4c6aadc1c5a54ae

猜你在找的PHP相关文章