mac php8.0升级8.1后项目报错
1. 运行环境
本地环境。线上还是php8.0项目没有问题,本地安装不了php8.0了,homebrew禁用php8.0所以升级8.1
. 当前使用的 php 版本?
PHP 版本:8.1
. 当前系统
Mac系统
2. 问题描述?
项目报错 执行php artisan –version也报错
PHP Deprecated: Return type of Illuminate\Container\Container::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Applications/phpstudy/WWW/new_mas/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 1231
Deprecated: Return type of Illuminate\Container\Container::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Applications/phpstudy/WWW/new_mas/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 1231
PHP Deprecated: Return type of Illuminate\Container\Container::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Applications/phpstudy/WWW/new_mas/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 1242
Deprecated: Return type of Illuminate\Container\Container::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Applications/phpstudy/WWW/new_mas/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 1242
PHP Deprecated: Return type of Illuminate\Container\Container::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Applications/phpstudy/WWW/new_mas/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 1254
Deprecated: Return type of Illuminate\Container\Container::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Applications/phpstudy/WWW/new_mas/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 1254
PHP Deprecated: Return type of Illuminate\Container\Container::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Applications/phpstudy/WWW/new_mas/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 1267
Deprecated: Return type of Illuminate\Container\Container::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Applications/phpstudy/WWW/new_mas/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 1267
PHP Deprecated: Return type of Illuminate\Config\Repository::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Applications/phpstudy/WWW/new_mas/vendor/laravel/framework/src/Illuminate/Config/Repository.php on line 141
Deprecated: Return type of Illuminate\Config\Repository::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Applications/phpstudy/WWW/new_mas/vendor/laravel/framework/src/Illuminate/Config/Repository.php on line 141
PHP Deprecated: Return type of Illuminate\Config\Repository::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Applications/phpstudy/WWW/new_mas/vendor/laravel/framework/src/Illuminate/Config/Repository.php on line 152
Deprecated: Return type of Illuminate\Config\Repository::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Applications/phpstudy/WWW/new_mas/vendor/laravel/framework/src/Illuminate/Config/Repository.php on line 152
PHP Deprecated: Return type of Illuminate\Config\Repository::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Applications/phpstudy/WWW/new_mas/vendor/laravel/framework/src/Illuminate/Config/Repository.php on line 164
Deprecated: Return type of Illuminate\Config\Repository::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Applications/phpstudy/WWW/new_mas/vendor/laravel/framework/src/Illuminate/Config/Repository.php on line 164
PHP Deprecated: Return type of Illuminate\Config\Repository::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Applications/phpstudy/WWW/new_mas/vendor/laravel/framework/src/Illuminate/Config/Repository.php on line 175
Deprecated: Return type of Illuminate\Config\Repository::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Applications/phpstudy/WWW/new_mas/vendor/laravel/framework/src/Illuminate/Config/Repository.php on line 175
PHP Fatal error: During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Illuminate\Support\Collection::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Applications/phpstudy/WWW/new_mas/vendor/laravel/framework/src/Illuminate/Support/Collection.php:1277
感谢各位大佬帮助,问题已顺利解决。最终将框架升级到了8以上版本,一切运行正常。(通过清除vendor文件夹并调整composer.json文件中的依赖版本,实现了顺利升级)