ReflectionParameter::getClass() will cause a fatal error (and trigger __autoload) if the class required by the parameter is not defined.
Sometimes it's useful to only know the class name without needing the class to be loaded.
Here's a simple function that will retrieve only the class name without requiring the class to exist:
<?php
function getClassName(ReflectionParameter $param) {
preg_match('/\[\s\<\w+?>\s([\w]+)/s', $param->__toString(), $matches);
return isset($matches[1]) ? $matches[1] : null;
}
?>