Skip to content
This repository has been archived by the owner on Jan 22, 2021. It is now read-only.

float values should receive some validation #208

Open
kleetus opened this issue Jun 13, 2016 · 2 comments
Open

float values should receive some validation #208

kleetus opened this issue Jun 13, 2016 · 2 comments

Comments

@kleetus
Copy link
Contributor

kleetus commented Jun 13, 2016

Item class, setPrice, if $price is a float, we probably should not allow a float with an invalid value.

Example:

$item.setPrice(1.111111111111) will set this value as a float on item, which cannot be used, ultimately, to create an invoice.

@Dadibom
Copy link

Dadibom commented Apr 13, 2018

What's an "invalid value"? Floating point numbers can't accurately store all numbers, for example 0.1.
The only solution imo is to throw an exception if a float is passed

@peter279k
Copy link

I agree with @Dadibom.

I think we can throw InvalidArgumentException if the value is float type.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants