Req #32177 [Asn->Opn]: ReflectionException

From: Date: Tue, 24 Oct 2017 06:54:04 +0000
Subject: Req #32177 [Asn->Opn]: ReflectionException
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-212028@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=32177&edit=1 ID: 32177 Updated by: kalle@php.net Reported by: pawel dot kozlowski at gmail dot com Summary: ReflectionException -Status: Assigned +Status: Open Type: Feature/Change Request Package: Reflection related Operating System: Any PHP Version: 5.0.3 -Assigned To: johannes +Assigned To: Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2012-03-05 08:58:20] daanleduc at hotmail dot com 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. ------------------------------------------------------------------------ [2005-03-03 16:29:24] pawel dot kozlowski at gmail dot com Description: ------------ I’m trying to use Reflection API. I works great, but I’ve some remarks regarding ReflectionException. Calling ReflectionParameter::getClass() will raise an exception when class definition isn’t already included. That’s fine, it’s 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

« previous php.bugs (#212028) next »