|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-12-20 14:08 UTC] jani@php.net
-Package: Feature/Change Request
+Package: Reflection related
[2012-03-05 08:58 UTC] daanleduc at hotmail dot com
[2017-10-24 06:54 UTC] kalle@php.net
-Status: Assigned
+Status: Open
-Assigned To: johannes
+Assigned To:
[2018-09-29 17:17 UTC] nikic@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: nikic
[2018-09-29 17:17 UTC] nikic@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 02:00:01 2025 UTC |
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 }