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);
}
}
}