Problem with (namespaced) code extending ReflectionProperty - possible bug?
| From: | Karsten Dambekalns | Date: | Mon, 08 Dec 2008 11:10:27 +0000 |
| Subject: | Problem with (namespaced) code extending ReflectionProperty - possible bug? | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-42141@lists.php.net to get a copy of this message | ||
Hi.
Running 5.3.0alpha3 now and converting our codebase to the new namespaces syntax. Works fine so far, the new name resolution rules are very usable and lead to cleaner code so far. :)
Now I ran into a problem. We have a class extending ReflectionProperty, and I got a complaint about the signature of our getValue() not matching that of the parent class. Ok, I added that stdclass type hint, fine. I thought.
Later on it turned out that I need to make that type hint \stdclass as our code is namespaced and I got an error because My\NS\stdclass could not be found. Now I got that signature mismatch warning again. Bummer. I decided to build a small test case, and now the fun starts.
According to the manual and the PHP source the signature is this:
public function getValue(stdclass $object)
This is my test code:
---- snip ----
<?php
class PropertyReflection extends ReflectionProperty {
public function getValue(stdclass $object) {}
}
?>
---- snip ----
and the result of running that is:
---- snip ----
Declaration of PropertyReflection::getValue() should be compatible with that of ReflectionProperty::getValue()
---- snip ----
I get that result even when using
* no type hint
* stdClass
The result stays the same when adding a namespace declaration and adjusting the typehint variations accordingly.
Can anybody shed some light on this? Or should I file a bug report right away?
Thanks,
Karsten