Re: [RFC] Scalar Type Hinting With Casts (re-opening)

From: Date: Mon, 14 Jul 2014 18:11:40 +0000
Subject: Re: [RFC] Scalar Type Hinting With Casts (re-opening)
References: 1 2 3 4 5 6 7 8 9  Groups: php.internals 
Request: Send a blank email to internals+get-75505@lists.php.net to get a copy of this message
On 14/07/14 16:41, Andrea Faulds wrote: >> The irritating thing here is HAVING to add the error_handler which may >> > well have been installed already for other reasons ... possibly in some >> > third party library to compensate for other changes? > The intention is obviously that you wouldn’t skip the E_RECOVERABLE_ERROR, but my point was > that if you really wanted to, you could. The other type hints are strict, hence this one is too, > it’s just tolerant of equivalent values that can be losslessly converted. > > If you want to pass user data safely to such a function, (int) or (float) first is probably a > good idea. Personally I like to handle the miss matched data and give the user a sensible response for each data item. This is only practical by individually handling each passed item so I don't want some other mechanism getting in the way of SIMPLY handling a data entry and it's miss matches. Often text has been added in the wrong place, and one can process that with a sensible response, something that creating a global warning/error does not allow. If I check for 'int' and it fails, then there may be something else entered that needs to be handled next rather than breaking out of a normal program flow by trapping the 'mistake'. Much of the error handling added these days breaks a logical program flow ... -- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

« previous php.internals (#75505) next »