Re: RFC: Type hinting revisited for PHP 5.3
| From: | Ionut G. Stan | Date: | Thu, 02 Jul 2009 11:31:27 +0000 |
| Subject: | Re: RFC: Type hinting revisited for PHP 5.3 | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-44636@lists.php.net to get a copy of this message | ||
On 7/2/2009 13:56, Hannes Magnusson wrote:
<?php
function throw_exception($errno, $errmsg) {
if (strpos($errmsg, "Argument ") === 0) {
throw new InvalidArgumentException($errmsg, $errno);
}
return false;
}
set_error_handler("throw_exception", E_RECOVERABLE_ERROR);
function foo(array $arr) {}
foo("string");
Actually, I'd use an exception class which extends from the builtin ErrorException
class, but that's not the point. Anyway, probably Kalle Sommer Nielsen is right,
and the way PHP already behaves in that regard should be kept. At least for now.
--
Ionut G. Stan
I'm under construction | http://igstan.blogspot.com/