AbstractServiceProvider::get_class()privateWC 1.0

Gets the class of a parameter.

This method is a replacement for ReflectionParameter::getClass, which is deprecated as of PHP 8.

{} It's a method of the class: AbstractServiceProvider{}

No Hooks.


\ReflectionClass|null. The class of the parameter, or null if it hasn't any.


// private - for code of main (parent) class only
$result = $this->get_class( $parameter );
$parameter(\ReflectionParameter) (required)
The parameter to get the class for.

Code of AbstractServiceProvider::get_class() WC 7.1.0

private function get_class( \ReflectionParameter $parameter ) {
	return $parameter->getType() && ! $parameter->getType()->isBuiltin()
		? new \ReflectionClass( $parameter->getType()->getName() )
		: null;