前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Lumen event 与 PHP7 扩展 event 出现冲突

Lumen event 与 PHP7 扩展 event 出现冲突

作者头像
美团骑手
发布2021-12-24 18:44:07
5500
发布2021-12-24 18:44:07
举报
文章被收录于专栏:技术进阶
lumen event 与 php7 扩展 event 冲突

系统报错日志

代码语言:javascript
复制
[2020-03-17 15:27:37] lumen.ERROR: ErrorException: Cannot declare class Event, because the name is already in use in /home/web/vendor/laravel/lumen-framework/src/Application.php:653
Stack trace:
#0 [internal function]: LaravelLumenApplication->LaravelLumenConcerns{closure}(2, 'Cannot declare ...', '/Volumes/docume...', 653, Array)
#1 /home/web/vendor/laravel/lumen-framework/src/Application.php(653): class_alias('IlluminateSupp...', 'Event')
#2 /home/web/vendor/laravel/lumen-framework/src/Application.php(631): LaravelLumenApplication->withAliases(Array)
#3 /home/web/vendor/laravel/lumen-framework/src/Application.php(766): LaravelLumenApplication->withFacades(true)
#4 /home/web/vendor/laravel/lumen-framework/src/Console/Kernel.php(54): LaravelLumenApplication->prepareForConsoleCommand(true)
#5 [internal function]: LaravelLumenConsoleKernel->__construct(Object(LaravelLumenApplication))
#6 /home/web/vendor/illuminate/container/Container.php(794): ReflectionClass->newInstanceArgs(Array)
#7 /home/web/vendor/illuminate/container/Container.php(644): IlluminateContainerContainer->build('AppConsoleKer...', Array)
#8 /home/web/vendor/laravel/lumen-framework/src/Application.php(211): IlluminateContainerContainer->make('AppConsoleKer...', Array)
#9 /home/web/vendor/illuminate/container/Container.php(231): LaravelLumenApplication->make('AppConsoleKer...', Array)
#10 /home/web/vendor/illuminate/container/Container.php(746): IlluminateContainerContainer->IlluminateContainer{closure}(Object(LaravelLumenApplication), Array)
#11 /home/web/vendor/illuminate/container/Container.php(644): IlluminateContainerContainer->build(Object(Closure), Array)
#12 /home/web/vendor/laravel/lumen-framework/src/Application.php(211): IlluminateContainerContainer->make('IlluminateCont...', Array)
#13 /home/web/artisan(32): LaravelLumenApplication->make('IlluminateCont...')
#14 {main}

看了一下,Application.php的第653行对应的方法

代码语言:javascript
复制
/**
     * Register the aliases for the application.
     *
     * @param  array  $userAliases
     * @return void
     */
    public function withAliases($userAliases = [])
    {
        $defaults = [
            'IlluminateSupportFacadesAuth' => 'Auth',
            'IlluminateSupportFacadesCache' => 'Cache',
            'IlluminateSupportFacadesDB' => 'DB',
            'IlluminateSupportFacadesEvent' => 'Event',
            'IlluminateSupportFacadesGate' => 'Gate',
            'IlluminateSupportFacadesLog' => 'Log',
            'IlluminateSupportFacadesQueue' => 'Queue',
            'IlluminateSupportFacadesSchema' => 'Schema',
            'IlluminateSupportFacadesURL' => 'URL',
            'IlluminateSupportFacadesValidator' => 'Validator',
        ];

        if (! static::$aliasesRegistered) {
            static::$aliasesRegistered = true;

            $merged = array_merge($defaults, $userAliases);
            foreach ($merged as $original => $alias) {
                class_alias($original, $alias);
            }
        }
    }
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2020-03-17,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • lumen event 与 php7 扩展 event 冲突
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档