安装了php8.1.3,composer2
安装最新版本tp的时候报错!
> @php think service:discover
PHP Fatal error: During inheritance of ArrayAccess: Uncaught think\exception\ErrorException: Return type of think\Request::offsetGet($name) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in D:\wwwroot\tp20220311\vendor\topthink\framework\src\think\Request.php:2156
Stack trace:
#0 D:\wwwroot\tp20220311\vendor\topthink\framework\src\think\Request.php(23): think\initializer\Error->appError()
#1 D:\wwwroot\tp20220311\vendor\composer\ClassLoader.php(571): include('...')
#2 D:\wwwroot\tp20220311\vendor\composer\ClassLoader.php(428): Composer\Autoload\includeFile()
#3 D:\wwwroot\tp20220311\app\Request.php(5): Composer\Autoload\ClassLoader->loadClass()
#4 D:\wwwroot\tp20220311\vendor\composer\ClassLoader.php(571): include('...')
#5 D:\wwwroot\tp20220311\vendor\composer\ClassLoader.php(428): Composer\Autoload\includeFile()
#6 [internal function]: Composer\Autoload\ClassLoader->loadClass()
#7 D:\wwwroot\tp20220311\vendor\topthink\framework\src\think\Container.php(375): ReflectionClass->__construct()
#8 D:\wwwroot\tp20220311\vendor\topthink\framework\src\think\Container.php(251): think\Container->invokeClass()
#9 D:\wwwroot\tp20220311\vendor\topthink\framework\src\think\Console.php(156): think\Container->make()
#10 D:\wwwroot\tp20220311\vendor\topthink\framework\src\think\Console.php(112): think\Console->makeRequest()
#11 D:\wwwroot\tp20220311\vendor\topthink\framework\src\think\Console.php(94): think\Console->initialize()
#12 [internal function]: think\Console->__construct()
#13 D:\wwwroot\tp20220311\vendor\topthink\framework\src\think\Container.php(394): ReflectionClass->newInstanceArgs()
#14 D:\wwwroot\tp20220311\vendor\topthink\framework\src\think\Container.php(251): think\Container->invokeClass()
#15 D:\wwwroot\tp20220311\vendor\topthink\framework\src\think\Container.php(130): think\Container->make()
#16 D:\wwwroot\tp20220311\vendor\topthink\framework\src\think\Container.php(510): think\Container->get()
#17 D:\wwwroot\tp20220311\think(10): think\Container->__get()
#18 {main} in D:\wwwroot\tp20220311\vendor\topthink\framework\src\think\Request.php on line 23
[think\exception\ErrorException]
During inheritance of ArrayAccess: Uncaught think\exception\ErrorException: Return type of think\Request::offsetGet
($name) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChan
ge] attribute should be used to temporarily suppress the notice in D:\wwwroot\tp20220311\vendor\topthink\framework\
src\think\Request.php:2156
Stack trace:
#0 D:\wwwroot\tp20220311\vendor\topthink\framework\src\think\Request.php(23): think\initializer\Error->appError()
#1 D:\wwwroot\tp20220311\vendor\composer\ClassLoader.php(571): include('...')
#2 D:\wwwroot\tp20220311\vendor\composer\ClassLoader.php(428): Composer\Autoload\includeFile()
#3 D:\wwwroot\tp20220311\app\Request.php(5): Composer\Autoload\ClassLoader->loadClass()
#4 D:\wwwroot\tp20220311\vendor\composer\ClassLoader.php(571): include('...')
#5 D:\wwwroot\tp20220311\vendor\composer\ClassLoader.php(428): Composer\Autoload\includeFile()
#6 [internal function]: Composer\Autoload\ClassLoader->loadClass()
#7 D:\wwwroot\tp20220311\vendor\topthink\framework\src\think\Container.php(375): ReflectionClass->__construct()
#8 D:\wwwroot\tp20220311\vendor\topthink\framework\src\think\Container.php(251): think\Container->invokeClass()
#9 D:\wwwroot\tp20220311\vendor\topthink\framework\src\think\Console.php(156): think\Container->make()
#10 D:\wwwroot\tp20220311\vendor\topthink\framework\src\think\Console.php(112): think\Console->makeRequest()
#11 D:\wwwroot\tp20220311\vendor\topthink\framework\src\think\Console.php(94): think\Console->initialize()
#12 [internal function]: think\Console->__construct()
#13 D:\wwwroot\tp20220311\vendor\topthink\framework\src\think\Container.php(394): ReflectionClass->newInstanceArgs(
)
#14 D:\wwwroot\tp20220311\vendor\topthink\framework\src\think\Container.php(251): think\Container->invokeClass()
#15 D:\wwwroot\tp20220311\vendor\topthink\framework\src\think\Container.php(130): think\Container->make()
#16 D:\wwwroot\tp20220311\vendor\topthink\framework\src\think\Container.php(510): think\Container->get()
#17 D:\wwwroot\tp20220311\think(10): think\Container->__get()
#18 {main}
Script @php think service:discover handling the post-autoload-dump event returned with error code 255 最佳答案