加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

PHP工匠突然不起作用

发布时间:2020-12-13 14:10:48 所属栏目:PHP教程 来源:网络整理
导读:我已经开始学习Laravel了.到现在为止,一切都很顺利.我正在关注本教程,我坚持使用 episode 7. 问题是我不能再开工匠了.我已经尝试安装修补程序,我可能更新了工匠,所以我最终没有工匠和修补程序.我正在使用Linux Ubuntu 12.04 LTS.我通过命令行安装了一切.之后
我已经开始学习Laravel了.到现在为止,一切都很顺利.我正在关注本教程,我坚持使用 episode 7.

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

php artisan –version

发生以下问题:

[ErrorException]
Declaration of AppProvidersEventServiceProvider::boot() should be
compati ble with
IlluminateFoundationSupportProvidersEventServiceProvider::boot
()

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

<?php

namespace AppProviders;

use IlluminateContractsEventsDispatcher as DispatcherContract;
use IlluminateFoundationSupportProvidersEventServiceProvider as ServiceProvider;

class EventServiceProvider extends ServiceProvider
{
    /**
     * The event listener mappings for the application.
     *
     * @var array
     */
    protected $listen = [
        'AppEventsSomeEvent' => [
            'AppListenersEventListener',],];

    /**
     * Register any other events for your application.
     *
     * @param  IlluminateContractsEventsDispatcher  $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  IlluminateContractsEventsDispatcher  $events
      * @return void
      */
-    public function boot(DispatcherContract $events)
+    public function boot()
     {
-        parent::boot($events);
+        parent::boot();

         //
     }

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

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读