Re: is_digits() and digits type

From: Date: Tue, 12 May 2015 22:14:02 +0000
Subject: Re: is_digits() and digits type
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-86185@lists.php.net to get a copy of this message
On 12/05/15 22:38, Rowan Collins wrote: > On 12 May 2015 22:32:55 BST, Rowan Collins <rowan.collins@gmail.com> wrote: >> >It is already possible to pass around, and type hint for, any class of >> >object, so you could for instance have a DatabaseID class. PHP's lack >> >of operator overloading makes that less appealing, perhaps, but it >> >would work. > Incidentally, it's still not the type hint that's performing validation here - that > would go in the constructor of the object, I guess. Rather, the type hint holds the promise that the > validation has already happened somewhere else. That most good libraries already have the validation code is my point here. Either the variable has already been validated, so the type hint is not relevant. OR the data still needs validating in which case only 'string' is now usable? With any pre-processing now requiring a switch back to string ... this is where I'm having problems seeing how if someone switches a library to using strict type hinting internally that will not have an impact on using the same library as it is currently being used without type hinting. -- 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 (#86185) next »