And now the attachment.
At 11:31 AM 12/25/2004 +0100, Sebastian Bergmann wrote:
[EMAIL PROTECTED] 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
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php