Hello Timm, Thursday, December 23, 2004, 1:06:01 AM, you wrote:
> On Wed, 2004-12-22 at 14:28 -0800, Andi Gutmans wrote: >> Hi, >> >> It seems that in the past few months ReflectionClass::getMethod() was >> changed to throw an Exception if the method doesn't exist. > -- snip -- > revision 1.113 > date: 2004/07/19 19:14:10; author: sebastian; state: Exp; lines: +9 > -5 > Make ReflectionClass::getMethod() and ReflectionClass::getProperty() > raise an ReflectionException instead of returning NULL on failure. > -- snip -- >> I don't understand the reasoning because as it's a reflection API I >> would expect it to return false > NULL would be better, IMO, but nevertheless. >> and not an exception. Exceptions should be thrown for errors. As long >> as we don't have hasMethod() then I think this behavior is wrong. > Agreed. >> Can anyone shed some light on this? Why was this changed? Marcus? > Ask Sebastian:) > I think what Sebastian wanted to do is: > $reflectionClass->getMethod('abc')->invoke($object); > ...and not have this bail with a fatal error when getMethod() returns > NULL, but raise an exception. Fine. I still think NULL->method() should > throw a NullPointerError instead of bailing but I also agree with Andi > that as long as there is no hasMethod() throwing an exception is > unacceptable. While i think using exceptions consistently everywhere in Reflection API is a good idea i also think we should have hasMethod() in either way. Best regards, Marcus mailto:[EMAIL PROTECTED] -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php