Zeev Suraski wrote (on 14/07/2014):
-----Original Message-----
From: Rowan Collins [mailto:rowan.coll...@gmail.com]
Sent: Monday, July 14, 2014 6:28 PM
To: internals@lists.php.net
Subject: Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)

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
Actually there's a pretty simple way that's not strict type hints:

5) Add type hints using existing syntax, which are casts;  Change casts
(both existing and these new ones) to emit a new E_CAST in case of data
loss or 'bogus' conversions.

Zeev

That's not consistent with current behaviour. This does not perform a cast, it performs strict validation:

function foo(array $bar) { /* ... */ }
foo('123');

Also, I already mentioned it:

Option 2 (or 3) could also be implemented by making *all* lossy casts emit some kind of notice.

The only *consistent* behaviour is strict validation, period. If you want that, use Hack; if you want some other kind of type hint, it has to introduce something new.

Reply via email to