Edit report at https://bugs.php.net/bug.php?id=32177&edit=1
ID: 32177 Comment by: daanleduc at hotmail dot com Reported by: pawel dot kozlowski at gmail dot com Summary: ReflectionException Status: Assigned Type: Feature/Change Request Package: Reflection related Operating System: Any PHP Version: 5.0.3 Assigned To: johannes Block user comment: N Private report: N New Comment: Had the same problem fixed it like this -> http://stackoverflow.com/questions/4513867/php-reflection-get-method-parameter- type-as-string/9500359#9500359 Would be better if there is an getClassName on reflection parameter. Previous Comments: ------------------------------------------------------------------------ [2005-03-03 16:29:24] pawel dot kozlowski at gmail dot com Description: ------------ Im trying to use Reflection API. I works great, but Ive some remarks regarding ReflectionException. Calling ReflectionParameter::getClass() will raise an exception when class definition isnt already included. Thats fine, its an expected behavior. The problem is that I have no way to get the missing class name. Ok, I could parse message string, but this way it becomes (unintentionally) part of the public API. What do You think about having sth like Class ReflectionExceptionClassNotDefined extends ReflectionException { public string getClassName(); } Reproduce code: --------------- class A { public function __construct(B $b) { $this->b = $b; } } $rc = new ReflectionClass('A'); $rconstr = $rc->getConstructor(); $rparams = $rconstr->getParameters(); try { $paramclass = $rparams[0]->getClass(); } catch (ReflectionException $e) { //no way to get 'B' name here, without parsing msg string } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=32177&edit=1