Re: ReflectionClass::getMethod()
| From: | Andi Gutmans | Date: | Thu, 30 Dec 2004 01:41:59 +0000 |
| Subject: | Re: ReflectionClass::getMethod() | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-14232@lists.php.net to get a copy of this message | ||
And now the attachment.
At 11:31 AM 12/25/2004 +0100, Sebastian Bergmann wrote:
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 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php