Closed bicpi closed 7 years ago
Just waiting on Travis to confirm all is well before a release.
Thank you for reporting this.
@rquadling Thanks for fixing this so fast 👍
Btw, what was bad with the early returns, isn't this a best-practice? More readable, less brittle, faster.
Normally early exits are for error states.
A single return point makes more sense to me as the result is not an error.
Error states? I think returns in object methods are there to return ... the return value :-) It's not the return value of a CLI command.
The earlier one can return the better, it avoids unnecessary nesting, hard to read else conditions etc.
Checkout http://williamdurand.fr/2013/06/03/object-calisthenics, nice read.
Changing the
stringify()
method in https://github.com/beberlei/assert/commit/70c865382bddeff1686738ba2c86fae2e50cbc30#diff-4066b84b483f6098378f612ecc64f381 introduced a BC break that broke my unit tests.Stringifying a boolean results in
1
instead of<TRUE>
as before because the early returns were removed.<TRUE>
is correctly assigned as a result first, but then overwritten by theis_scalar()
check because a boolean is a scalar, too.I could do a PR to revert if you like, but what was the intention of this change?