beberlei / assert

Thin assertion library for use in libraries and business-model
Other
2.41k stars 186 forks source link

Add 'between'? #171

Closed holtkamp closed 8 years ago

holtkamp commented 8 years ago

While writing this:

Assertion::greaterOrEqualThan($weekday, 1);
Assertion::lessOrEqualThan($weekday, 7);

made me looking for a between function:

Assertion::between($weekday, 1, 7);

Seems useful... Or has it been considered and purposly not adopted? Would a PR be considered?

rquadling commented 8 years ago

Absolutely a PR would be considered.

Please read the CONTRIBUTING.md guide first.

Thank you.

localheinz commented 8 years ago

@holtkamp

Maybe worth considering an argument that allows to exclude the borders?

Or should we have How about we also add an separate assertion that excludes the borders?

Assertion::betweenExclusive($weekday, 0, 8);
holtkamp commented 8 years ago

@localheinz good one, haven't got time to work on this though 😞

holtkamp commented 8 years ago

https://github.com/beberlei/assert/pull/179

"wow, that escalated quickly!" Awesome @localheinz!

rquadling commented 8 years ago

Sometimes we don't wait around.