IMHO if php is going to have the option to use type hinted parameters (which
I really like) then it should have the option to use type hinted variables
as well. Half stepping with the type hints are just going to complicate
things. Afterall, NULL is a value and not a type. And if you use a type
hinted parameter in your function - the argument passed to it, when
declared, should be type hinted as well or throw an E_STRICT. Like many
things this is probably easier said than done but.....
<?php
class UserClass {
public static function forName($name, ClassLoader $c) {
// ...
}
}
ClassLoader $cl = NULL;
UserClass::forName("somename", $cl); // passes the type hint
$cl2 = NULL;
UserClass::forName("somename", $cl); // throws an E_STRICT
?>
No funny synatx no magic just clean code.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php