Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:14210 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 4189 invoked by uid 1010); 25 Dec 2004 10:41:50 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 4096 invoked from network); 25 Dec 2004 10:41:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Dec 2004 10:41:49 -0000 X-Host-Fingerprint: 80.91.229.2 main.gmane.org Linux 2.4/2.6 Received: from ([80.91.229.2:59133] helo=main.gmane.org) by pb1.pair.com (ecelerity HEAD (r3985)) with SMTP id 95/7E-29078-CE34DC14 for ; Sat, 25 Dec 2004 05:41:49 -0500 Received: from root by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1Ci9Mo-0001pe-00 for ; Sat, 25 Dec 2004 11:41:46 +0100 Received: from p3ee225a2.dip.t-dialin.net ([62.226.37.162]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 25 Dec 2004 11:41:46 +0100 Received: from sb by p3ee225a2.dip.t-dialin.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 25 Dec 2004 11:41:46 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: internals@lists.php.net Date: Sat, 25 Dec 2004 11:31:58 +0100 Lines: 40 Message-ID: References: <5.1.0.14.2.20041222142706.02653980@localhost> <1103794397.311.37.camel@localhost> <5.1.0.14.2.20041223133804.0265d4c0@localhost> <41CC25D1.5080408@cschneid.com> <41CC562E.6090005@cschneid.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: p3ee225a2.dip.t-dialin.net User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en In-Reply-To: X-Enigmail-Version: 0.89.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Sender: news Subject: Re: [PHP-DEV] ReflectionClass::getMethod() From: sb@sebastian-bergmann.de (Sebastian Bergmann) ilya77@gmail.com wrote: > Why not just returning null when a method does not exist? > Actually CALLING a non-existing method should be treated as an error... Because try { $class = new ReflectionClass($this); $method = $class->getMethod($this->name); } catch (ReflectionException $e) { $this->fail($e->getMessage()); } is clearer than try { $class = new ReflectionClass($this); } catch (ReflectionException $e) { $this->fail($e->getMessage()); } $method = $class->getMethod($this->name); if ($method !== NULL) { // ... } else { // ... } I fail to see why exceptions wee introduced when they are not to be consistently used in functionality that was added at the same time, like for instance the Reflection API. -- Sebastian Bergmann http://www.sebastian-bergmann.de/ GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69