On 02/02/15 21:17, Christoph Becker wrote:
>> Instead of multiple strict scalar hints (e.g. function addVat(int|float 
>> $amount){...}), I would prefer to have "numeric" as strict type:
>> > function addVat(numeric $amount){...}
> Have you considered
> 
>   addVat(-1);

Also addVat(1.235); which will be rounded to two decimal places ...
silently in this case.
A negative amount may be acceptable - credit note - and a one off price
may be a finer fraction, but this example shows a couple of other
potential errors.

As I have already said ... 'strict' may well only be a subset of the
error check. A "numeric" type would introduce the problem of scale of
number. Something which any of the database extensions already manage on
a field by field basis.

-- 
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

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to