close

[Solved] Deprecated: Method ReflectionParameter::getClass() is deprecated in Container.php

Hello Guys, How are you all? Hope You all Are Fine. Today I am just updated my php version 8 and now I am facing following error in my laravel project Deprecated: Method ReflectionParameter::getClass() is deprecated in Container.php. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Deprecated: Method ReflectionParameter::getClass() is deprecated in Container.php Error Occurs ?

I am just updated my php version 8 and now I am facing following error in my laravel project.

Deprecated: Method ReflectionParameter::getClass() is deprecated in /Users/.../Sites/.../vendor/laravel/framework/src/Illuminate/Container/Container.php on line 871

Deprecated: Method ReflectionParameter::getClass() is deprecated in /Users/.../Sites/.../vendor/laravel/framework/src/Illuminate/Container/Container.php on line 945

Deprecated: Method ReflectionParameter::getClass() is deprecated in /Users/.../Sites/.../vendor/laravel/framework/src/Illuminate/Container/Container.php on line 871

Deprecated: Method ReflectionParameter::getClass() is deprecated in /Users/.../Sites/.../vendor/laravel/framework/src/Illuminate/Container/Container.php on line 945

How To Solve Deprecated: Method ReflectionParameter::getClass() is deprecated in Container.php Error ?

  1. How To Solve Deprecated: Method ReflectionParameter::getClass() is deprecated in Container.php Error ?

    To Solve Deprecated: Method ReflectionParameter::getClass() is deprecated in Container.php Error Just follow below all step to update for latest version of laravel 6, 7 and 8 has made changes required for php 8. Open Your Composer and add php 8 Like below. “php”: “^7.4|^8.0” Now Just run This command So that we can update laravel to the latest version composer update.

  2. Deprecated: Method ReflectionParameter::getClass() is deprecated in Container.php

    To Solve Deprecated: Method ReflectionParameter::getClass() is deprecated in Container.php Error Just follow below all step to update for latest version of laravel 6, 7 and 8 has made changes required for php 8. Open Your Composer and add php 8 Like below. “php”: “^7.4|^8.0” Now Just run This command So that we can update laravel to the latest version composer update.

Solution 1: Follow this step

Just follow below all step to update for latest version of laravel 6, 7 and 8 has made changes required for php 8.

Open Your Composer and add php 8 Like below.

"php": "^7.4|^8.0",

Now Just run This command So that we can update laravel to the latest version

composer update

Also Update this libraries

PHP to php:^8.0
Faker to fakerphp/faker:^1.9.1
PHPUnit to phpunit/phpunit:^9.3

Solution 2: This methods are deprecated in php 8

In PHP 8, the following methods from ReflectionParameter class is deprecated:

ReflectionParameter::getClass()
ReflectionParameter::isArray()
ReflectionParameter::isCallable()

ReflectionParamter::getType() is the recommended way to replace the deprecated methods. This method is available in PHP 7.0 and later.

Summary

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also, Read

Please Rate Our Solution to Motivate Us For Give Our Best

Leave a Comment