Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:14189 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72916 invoked by uid 1010); 23 Dec 2004 07:47:43 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 72881 invoked from network); 23 Dec 2004 07:47:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Dec 2004 07:47:43 -0000 X-Host-Fingerprint: 83.97.50.139 jan.prima.de FreeBSD 4.6-4.9 Received: from ([83.97.50.139:4946] helo=jan.prima.de) by pb1.pair.com (ecelerity HEAD (r3983)) with SMTP id 2E/0E-06723-E187AC14 for ; Thu, 23 Dec 2004 02:47:42 -0500 Received: from BAUMBART (pD95F8A3C.dip.t-dialin.net [::ffff:217.95.138.60]) (IDENT: HydraIRC, AUTH: LOGIN tobi) by jan.prima.de with esmtp; Thu, 23 Dec 2004 07:47:12 +0000 Date: Thu, 23 Dec 2004 08:47:29 +0100 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <1747956759.20041223084729@marcus-boerger.de> To: Andi Gutmans , Sebastian Bergmann , Timm Friebe CC: internals@lists.php.net In-Reply-To: <1103760361.311.23.camel@localhost> References: <5.1.0.14.2.20041222142706.02653980@localhost> <1103760361.311.23.camel@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] ReflectionClass::getMethod() From: helly@php.net (Marcus Boerger) 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:helly@php.net