Am 27.05.2010 12:59, schrieb Ilia Alshanetsky:
As far as your example goes consider a function that expects a boolean, but
instead gets an int/string/float, which in nearly all cases will result in
TRUE. Which is not the desired outcome.
Which is why, for instance, PHPUnit today is full of code like this
public function foo($flag)
{
if (!is_bool($flag)) {
throw new InvalidArgumentException(/* ... */);
}
}
This is the type of code that I want to get rid off using scalar type
hints.
--
Sebastian Bergmann Co-Founder and Principal Consultant
http://sebastian-bergmann.de/ http://thePHP.cc/
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php