+1

> -----Original Message-----
> From: Derick Rethans [mailto:[EMAIL PROTECTED]
> Sent: Monday, August 08, 2005 11:50 AM
> To: PHP Developers Mailing List
> Subject: [PHP-DEV] type hinting throwing a fatal error
> 
> Hei,
> 
> currently if you pass a wrong object's type to a typehinted parameter:
> 
>       [EMAIL PROTECTED]:~$ cat /tmp/foo.php
>       <?php
>       class foo {
>               function bar(foo $a)
>               {
>               }
>       }
> 
>       $a = new foo;
>       $a->bar(new stdClass);
>       ?>
>       [EMAIL PROTECTED]:~$ php /tmp/foo.php
> 
>       Fatal error: Argument 1 must be an instance of foo in /tmp/foo.php
> on
>       line 3
> 
> As type hinting is a new OO thing, it might perhaps make some sense to
> make this an exception instead - as this error might also happen for
> dynamic things by people who use the classes you designed. In that case
> having this fatal error to stop the whole application can be annoying.
> Opinions?
> 
> Derick
> 
> --
> 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

Reply via email to