As per the Adobe Magento 2 Official documentation. System requirements for Magento 2.4.5 is PHP 8.1
I am getting following error.
Exception: Deprecated Functionality: Method ReflectionParameter::getClass()
Most of the solutions on internet suggest installation of PHP 7.4 but then PHP 7.4 doesn't match with official requirements.
Can I get some expert advice/solution on this issue.

  • Please post a complete error message with a trace for better understanding. Mar 27 at 10:09

2 Answers 2


You have to use PHP 8.1 for Magento 2.4.5

There are some suggestions that say that using PHP 7 (or 7.4) is for the upgrade process, once you upgrade your site to Magento 2.4.5, you have to switch to PHP 8.1

Related question: M2 - Deprecated Functionality: Method ReflectionParameter::getClass() is deprecated in vendor/magento/framework/Code/Reader/ClassReader.php on line 34


Base on the PHP8.0 you can replace that function by getType()

Use ReflectionParameter::getType() and the ReflectionType APIs should be used instead

Check the PHP document: https://www.php.net/manual/en/reflectionparameter.getclass.php

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.