Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:14174 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95452 invoked by uid 1010); 23 Dec 2004 00:06:09 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 95411 invoked from network); 23 Dec 2004 00:06:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Dec 2004 00:06:09 -0000 X-Host-Fingerprint: 212.227.126.187 moutng.kundenserver.de Received: from ([212.227.126.187:58522] helo=moutng.kundenserver.de) by pb1.pair.com (ecelerity HEAD (r3983)) with SMTP id 66/64-16060-0FB0AC14 for ; Wed, 22 Dec 2004 19:06:09 -0500 Received: from [212.227.126.208] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 1ChGUV-000634-00 for internals@lists.php.net; Thu, 23 Dec 2004 01:06:03 +0100 Received: from [80.139.2.102] (helo=p508B0266.dip0.t-ipconnect.de) by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) id 1ChGUV-0006UM-00 for internals@lists.php.net; Thu, 23 Dec 2004 01:06:03 +0100 To: internals@lists.php.net In-Reply-To: <5.1.0.14.2.20041222142706.02653980@localhost> References: <5.1.0.14.2.20041222142706.02653980@localhost> Content-Type: text/plain Date: Thu, 23 Dec 2004 01:06:01 +0100 Message-ID: <1103760361.311.23.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit X-Provags-ID: kundenserver.de abuse@kundenserver.de auth:e958292ea7b1c44e51b2b9ca0a9da460 Subject: Re: [PHP-DEV] ReflectionClass::getMethod() From: thekid@thekid.de (Timm Friebe) 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