Felipe Pena wrote:
> Well, thinking better about the behavior of type hinting, i decided to
> change the proposal for strict type. I.e. don't accept numeric string
> as an intenger, etc.
While it is now consistent with is_int() it means we end up with strict
but also stupid interfaces and hence lots of silly type conversions in
application code using such a function.
This is especially annoying as you normally have very few
implementations of a function but lots of code calling it.
You basically 'progressed' from
function foo($x) { $x = (int)$x; ... } # One place where type is
ensured or converted
foo(42);
foo(CONSTANT_42);
foo($x);
foo($db->x);
to
function foo(int $x) { ... }
foo(42);
foo((int)CONSTANT_42); # If you are not 100% about type
foo((int)$x); # If you are not 100% about type
foo((int)$db->x); # DBs normally return strings
- Chris
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php