Closed Ayesh closed 4 years ago
Are you planning to fix this PR?
@l0gicgate - I will update tests to make sure we improve the coverage. Previously, the entirety of the test-covered code was inside a big if
statement, which made the coverage reach 100%. But now, the logic is inverted and there is an early-return, which there is no longer a test for. I will push another commit with tests. Thank you.
@ayesh I’ll wait until coverage is back to 100% to merge! Thanks
@l0gicgate - I added a new test to cover the branch that fell behind in tests. Coverage back to 100% now. Thanks.
Hi there, I noticed a few minor improvements that we could make in the
Guard
class.Guard::__construct
has a call that it initializes$this->keyPair = null
. This can be moved to the property declaration without changing the functionality.$strength < 16
check, which can be moved to the top as well, so the later calls are not executed if we have to throw an exception. The early calls do not mutate state.Guard::validateToken()
andGuard::enforceStorageLimit()
methods have nestedif
calls, which can be removed in favor of early returns.Fingers crossed this can be merged, and I'm open to make any further changes if necessary. Thank you for your time.