> -----Original Message----- > From: Andrea Faulds [mailto:a...@ajf.me] > Sent: Monday, July 14, 2014 5:58 PM > To: Derick Rethans > Cc: PHP internals > Subject: Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening) > > > On 14 Jul 2014, at 15:54, Derick Rethans <der...@php.net> wrote: > > > A compromise by adding more inconsistencies. > > > > I can buy the cast of scalars vs hint--of-complex types, but > > definitely not the introduction of a new group of casting rules. Keep it > simple. > > It doesn't change the casting rules; write an error handler that ignores > E_RECOVERABLE_ERROR and you get exactly the same result as a manual cast > inside the function. Rather, it simply adds validation. The casting works like > casting does everywhere else, but there's strict lossless validation on the type > hint, similar to the non-scalar type hints except more lenient as it allows > equivalent values of other types.
It does, as it creates an error (recoverable or not), and it doesn't allow "13abc" to easily turn into 13 (int), even if you implement an error handler that ignores E_RECOVERABLE_ERROR. Zeev -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php