Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:14175 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48997 invoked by uid 1010); 23 Dec 2004 00:43:58 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 48952 invoked from network); 23 Dec 2004 00:43:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Dec 2004 00:43:58 -0000 X-Host-Fingerprint: 80.74.107.235 mail.zend.com Linux 2.4/2.6 Received: from ([80.74.107.235:55308] helo=mail.zend.com) by pb1.pair.com (ecelerity HEAD (r3983)) with SMTP id F8/C7-16060-DC41AC14 for ; Wed, 22 Dec 2004 19:43:58 -0500 Received: (qmail 17596 invoked from network); 23 Dec 2004 00:43:53 -0000 Received: from localhost (HELO andi-notebook.zend.com) (127.0.0.1) by localhost with SMTP; 23 Dec 2004 00:43:53 -0000 Message-ID: <5.1.0.14.2.20041222164315.026897a0@localhost> X-Sender: andi@localhost X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Wed, 22 Dec 2004 16:43:50 -0800 To: Timm Friebe ,internals@lists.php.net, Sebastian Bergmann In-Reply-To: <1103760361.311.23.camel@localhost> References: <5.1.0.14.2.20041222142706.02653980@localhost> <5.1.0.14.2.20041222142706.02653980@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Re: [PHP-DEV] ReflectionClass::getMethod() From: andi@zend.com (Andi Gutmans) Thanks Timm. Sebastian, what do you think? Andi At 01:06 AM 12/23/2004 +0100, Timm Friebe 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. > >-- >Timm >If it ain't broken, it doesn't have enough features yet > >-- >PHP Internals - PHP Runtime Development Mailing List >To unsubscribe, visit: http://www.php.net/unsub.php