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.

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.

AbstractServiceProvider::get_class() code WC 8.7.0

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