Derick Rethans wrote (on 14/07/2014):
A compromise by adding more inconsistencies.
The only way of not introducing some inconsistencies (or, to put it
another way, new features) is to use strict type hints, which perform no
casting, and error on invalid input, since that's what the existing type
hints do, in particular "array". There's broad consensus that that
wouldn't be very "PHP-ish", and it has been rejected in previous
discussions.
Here are the main variants discussed in this thread:
1) add type hints using existing syntax, but which are actually silent
casts, rather than the strict validation performed for existing types
2) add type hints using existing syntax, which are casts, but also act
differently from existing casts by emitting some kind of notice
3) add cast hints using a new syntax
4) add type hints using existing syntax, which use a new "lossless
cast", i.e. perform validation for completely wrong input ('abc' as an
int param) but allow juggling for "reasonable" input ('123' as an int
param).
Option 2 (or 3) could also be implemented by making *all* lossy casts
emit some kind of notice.
This RFC currently proposes option 4.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php