What's wrong with instanceof? You can then throw fatal error if you
want, it's just two lines:
if(!($foo instanceof Bar)) {
trigger_error(E_USER_ERROR, "Wrong foo!");
}
That's 3 lines on top of the line where you assign the value, and you forgot
the 4th line for the IDE:
-----
/* @var $foo Bar */
$foo = expression();
if(!($foo instanceof Bar)) {
trigger_error(E_USER_ERROR, "Wrong foo!");
}
-----
Versus this:
----
Bar $foo = expression();
----
And assignment is a kinda common operation. So I hope you can see what's
wrong with it now.
Stan
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php