Repository navigation
verifyAll() returns how many checks it verified - #154
Merged
Merged
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…d minor The compatibility policy amended in this PR admits widening a return type where no caller can observe the change; teach the gate to recognise exactly that case: every finding must be a 'changed from void to the non-covariant' widening, the named class must reflect as final against the checkout, and the top CHANGELOG heading must be a minor above the latest tag. Anything else still fails. CHANGELOG declares 1.1.0 - the minor this ships in.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #153
What
Understudy::verifyAll()now returnsint<0, max>— how many checks it verified — instead ofvoid, so a runner adapter can count real assertions instead of a flat one per test (understudy-phpunit'sassertPostConditions()doesaddToAssertionCount(1)whether the test armed one expectation or fifteen).One check, precisely
expect(), ortimes()on a stub);strictStubs, where its use is what is checked;A failed check throws, so the number only ever counts checks that passed. Checks
verify()made earlier are not part of it: those answered at their own call sites, andverifyAll()does not re-decide them.Compatibility
void → intis source-compatible for every existing caller: the method answered nothing before, so no caller could have read the answer, andUnderstudyisfinal, so no override shadows it.composer bc-check -- --from=v1.0.1agrees:The compatibility policy in both READMEs previously said "retyping an existing public member is a major-version change", which would have made this a 2.0 for a change no caller can observe. The policy now says a return type may be widened in a minor release where no caller can observe the change (and the same reasoning admits a parameter widened to a supertype every existing argument already satisfies); narrowing is never minor. The paragraph quotes this very change as its first application.
Notes for reviewers
checkOrdering()split intoorderedExpectations()(the collector) +orderingFailure()(the renderer), because the count needs to know whether an ordering constraint existed without re-walking states.allVerified()keeps its behaviour:orderingFailure(orderedExpectations($state)).failuresIn()returnsarray{list<VerificationFailure>, int<0, max>}now — counted by what is checked, not what passed: a failed check throws before the number exists anyway.docs/src/api/**regenerated withmake docs-api; the wide diff is the catch-up of version strings and satellite references from the already-committeddocs/.api-workspace/composer.lockmove, plus the realverifyAll()docblock change.max(1, n), understudy-testo metric+n) follow once this merges; the adapter contract suites in this repo's CI run against core HEAD either way.