Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 298090

\ReflectionParamter::getClass() is deprecated in PHP 8.0

$
0
0

Problem/Motivation

PHP has deprecated \ReflectionParamter::getClass(). We should replace our usages of it:

We use it in:

  • ArgumentsResolver
  • EntityResolverManager
  • ProxyBuilder
  • TaggedHandlersPass

Proposed resolution

Add helper to core/lib/Drupal/Component/Utility to handle this. Hopefully this approach will make it easier to backport to Drupal 8 and supporting PHP7 means that we need to still use getClass() there. It's not necessary at all in Drupal 9 since the reflection classes and methods we should use exist since PHP 7.2.

Remaining tasks

None

User interface changes

None

API changes

Calls to \ReflectionParameter::getClass() should be replaced with \Drupal\Component\Utility\Reflection::getParameterClassName($parameter);. Note that Reflection::getParameterClassName() returns the class name as a string and not a \ReflectionClass object.

Data model changes

None

Release notes snippet

In order to be PHP 8 compatible code that uses \ReflectionParameter::getClass() should use the new utility \Drupal\Component\Utility\Reflection::getParameterClassName() instead. See


Viewing all articles
Browse latest Browse all 298090

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>