Andi Gutmans wrote:
> Exceptions should be thrown for errors.
And trying to get a method that does not exist is an error.
> Can anyone shed some light on this? Why was this changed?
To make consistent use of ReflectionException, IIRC.
For instance, the following code
<?php
$method = new ReflectionMethod(
'NotExistingClass',
'notExistingMethod'
);
?>
throws an ReflectionException as well. Now one could argue that there
is no other way to signal an error in the __construct() than to use
methods, but I think it is better to use the same error signalling in
bith ReflectionClass::getMethod() and ReflectionMethod::__construct().
And besides, it is what Java does [1], so we cannot be that far off :-)
Seasons's Greetings,
Sebastian
--
[1] http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Class.html
--
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