#36687 [Asn->Csd]: ReflectionParameter::getDeclaringClass returns wrong result
| From: | helly@php.net | Date: | Sun, 12 Mar 2006 17:22:57 +0000 |
| Subject: | #36687 [Asn->Csd]: ReflectionParameter::getDeclaringClass returns wrong result | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-94227@lists.php.net to get a copy of this message | ||
ID: 36687
Updated by: helly@php.net
Reported By: elias at adaptiveinstance dot com
-Status: Assigned
+Status: Closed
Bug Type: Feature/Change Request
Operating System: *
-PHP Version: 5CVS-2006-03-10 (snap)
+PHP Version: 5.1.2
Assigned To: helly
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2006-03-12 16:39:56] helly@php.net
After discussing this issue again we found that indeed
getClass() should return the typehine class if any and
getDeclaringClass() should return where the parameter is defined which
is the class of the method if it is a method and NULL otherwise.
Fixed in head now, fix for 5.1.3 will come, too.
------------------------------------------------------------------------
[2006-03-12 00:00:42] helly@php.net
In that case you found an error besides your request.
------------------------------------------------------------------------
[2006-03-11 20:07:38] elias at adaptiveinstance dot com
In that case i must understand anythink completely wrong or...
---code
class Foo
{
function myMeth($param0){}
}
$class = new ReflectionClass('Foo');
$params = $class->getMethod('myMeth')->getParameters();
var_dump($params[0]->getDeclaringClass());
---output
NULL
---end
...NULL is the declaring class.
------------------------------------------------------------------------
[2006-03-11 18:34:09] helly@php.net
It definitively returns which class declared the parameter.
You are in RelfectionParameter here not in RelfectionTypeHint which
doesn't exist.
------------------------------------------------------------------------
[2006-03-11 18:30:00] elias at adaptiveinstance dot com
Alias or not, getDeclaringClass does not return the 'declaring' class
and i don't think someone expects this.
getTypeHintClass sounds good.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/36687
--
Edit this bug report at http://bugs.php.net/?id=36687&edit=1