PHP 8.5.0 Alpha 4 available for testing

Voting

: eight minus two?
(Example: nine)

The Note You're Voting On

tarik at bitstore dot ru
4 years ago
You may use this one function instead depricated

/**
* Get parameter class
* @param \ReflectionParameter $parameter
* @return \ReflectionClass|null
*/
private function getClass(\ReflectionParameter $parameter):?\ReflectionClass
{
$type = $parameter->getType();
if (!$type || $type->isBuiltin())
return NULL;

// This line triggers autoloader!
if(!class_exists($type->getName()))
return NULL;


return new \ReflectionClass($type->getName());
}

<< Back to user notes page

To Top