0

After switching from my Laravel 6 branch back to my Laravel 5.5 branch, I'm encountering several deprecation errors related to the ReflectionParameter::getClass() method in my application. The errors are as follows:

Deprecated: Method ReflectionParameter::getClass() is deprecated in /private/var/www/finconnect/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 811

Deprecated: Method ReflectionParameter::getClass() is deprecated in /private/var/www/finconnect/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 885

I have attempted multiple solutions to resolve these errors, including:

Clearing various Laravel caches:

php artisan cache:clear, php artisan config:clear, php artisan view:clear

Removing the vendor directory and reinstalling dependencies:

rm -rf vendor/, composer clearcache, composer dump-autoload -o

The documentation suggests that ReflectionParameter::getClass() is deprecated as of PHP 8, recommending the use of ReflectionParameter::getType() instead. However, I'm currently running PHP 7.3, as confirmed by php -v, and my Valet setup appears to be healthy.

PHP 7.3.33 (cli) (built: Dec 27 2023 06:53:55) ( NTS )

Check Success?
Is Valet fully installed? Yes
Is Valet config valid? Yes
Is Homebrew installed? Yes
Is DnsMasq installed? Yes
Is Dnsmasq running? Yes
Is Dnsmasq running as root? Yes
Is Nginx installed? Yes
Is Nginx running? Yes
Is Nginx running as root? Yes
Is PHP installed? Yes
Is linked PHP ([email protected]) running? Yes
Is linked PHP ([email protected]) running as root? Yes
Is valet.sock present? Yes

I'm puzzled by these deprecation notices since they're supposed to only apply to PHP 8 and above. Has anyone faced similar issues when working with Laravel 5.5 on PHP 7.3, or does anyone have insights on how to resolve these deprecation warnings? Any help or suggestions would be greatly appreciated.

3
  • ReflectionParameter::getClass was deprecated in PHP 8.0. Laravel 5.5 is too old (it was released before PHP 8). Commented Feb 16, 2024 at 11:13
  • Even though this shouldn't happen with valet, try to run phpinfo() from within the app to see what version it is actually running on. php -v only shows what PHP version is running for CLI. Commented Feb 17, 2024 at 2:44
  • I'm puzzled by these deprecation notices since they're supposed to only apply to PHP 8 and above. ... I don't know why some call these errors, as the app would not run at all if they were, but anyway, you have a version before PHP 8, and those messages indicate that a PHP function used somewhere in the code is no longer supported IN A FUTURE, i.e. higher PHP version, NOT the version currently being used. Commented Feb 17, 2024 at 2:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.