ID: 32177
Updated by: [EMAIL PROTECTED]
Reported By: pawel dot kozlowski at gmail dot com
-Status: Open
+Status: Assigned
Bug Type: Feature/Change Request
Operating System: Any
PHP Version: 5.0.3
-Assigned To:
+Assigned To: johannes
New Comment:
Previous Comments:
------------------------------------------------------------------------
[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 http://bugs.php.net/?id=32177&edit=1