RE: [PHP-DEV] Scalar type hinting

From: Date: Mon, 27 Feb 2012 22:28:03 +0000
Subject: RE: [PHP-DEV] Scalar type hinting
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.internals 
Request: Send a blank email to internals+get-58206@lists.php.net to get a copy of this message
> -----Original Message----- > From: John LeSueur [mailto:john.lesueur@gmail.com] > > Maybe this discussion should start from the end of the last discussion on non-strict type > hints, where really smart people came up with some options to handle the conversion: > > > https://wiki.php.net/rfc/typecheckingstrictandweak#option_1_current_type_juggeling_rules_with_e_strict_on_data_loss > > The RFC talks about throwing E_STRICT or E_FATAL, and has a couple of options for a matrix of > conversion rules. I've actually read that proposal. To some level it is good, but I felt like there were too many problems. E_ERROR is overkill. For comparison, (function (array $bar) {})('a') generates a catchable fatal error (E_RECOVERABLE_ERROR) so that's the furthest this should go in any case, but when dealing with jugglable types and there's just some unexpected data loss even E_RECOVERABLE_ERROR is too much IMO; E_WARNING or E_NOTICE would be more appropriate. IIRC it also failed conversions too aggressively. John Crenshaw Priacta, Inc.

« previous php.internals (#58206) next »