Chris Stockton schrieb:
Why on earth would you have int, string, resource, etc "return type hints"
and then turn around and suggest for parameter hinting just add a scalar
type? That makes no sense and is so inconsistent.

static int function retarded(scalar $value) {
    return (int) $value; // lol....
}

Let me turn your question around: Why on earth would someone restrict a function to int when string works just as well?

function int foo_flexible(scalar $x) { return $x + 42; }
$foo = foo_flexible($value);

function int foo_retarded(int $x) { return $x + 42; }
$foo = foo_retarded((int)$value);       # :-(

That said, I'll be using
function foo($x) { return $x + 42; }
anyway and let PHP warnings take care of the rest ;-)

- Chris


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to