Problem:
Upgrading to PHP 8 has rendered a Laravel application dysfunctional, causing the following deprecation warnings:
Deprecated: Method ReflectionParameter::getClass() is deprecated in /Users/.../Sites/.../vendor/laravel/framework/src/Illuminate/Container/Container.php on line 871 ...
Solution:
As PHP 8 introduces revisions to type systems, certain Reflection API methods within ReflectionParameter are now obsolete. To resolve this issue, follow these steps:
"php": "^7.4|^8.0",
composer update
PHP: ^8.0 Faker: fakerphp/faker:^1.9.1 PHPUnit: phpunit/phpunit:^9.3
Explanation:
PHP 8's enhancements to type systems have caused incorrect results from certain Reflection API methods in ReflectionParameter. Hence, the following deprecated methods should be replaced with ReflectionParameter::getType():
ReflectionParameter::getClass() ReflectionParameter::isArray() ReflectionParameter::isCallable()
以上がPHP 8 アップグレード後に Laravel アプリが壊れた場合はどうすればよいですか?の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。