New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#3120 implemented TestCase#createStub()
#3810
Merged
sebastianbergmann
merged 10 commits into
sebastianbergmann:master
from
Ocramius:feature/#3120-stubs-implementation
Sep 6, 2019
Merged
#3120 implemented TestCase#createStub()
#3810
sebastianbergmann
merged 10 commits into
sebastianbergmann:master
from
Ocramius:feature/#3120-stubs-implementation
Sep 6, 2019
Conversation
This file contains 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
… false positive The method `InvocationMocker#will()` is LSP-compliant with the parent types, but a bug in psalm reports it as a false positive. Ref: vimeo/psalm#2102
Ocramius
commented
Sep 6, 2019
I was too eager in using an appropriate type declaration on `InvocationMocker`, but that has to wait for newer PHP releases.
Once we have PHP 7.4, we can move these type declarations into the interface signature again, but for now, the existing inheritance leads to a crash on PHP < 7.4.
Codecov Report
@@ Coverage Diff @@
## master #3810 +/- ##
============================================
+ Coverage 82.5% 82.56% +0.06%
- Complexity 3834 3835 +1
============================================
Files 150 150
Lines 10146 10148 +2
============================================
+ Hits 8371 8379 +8
+ Misses 1775 1769 -6
Continue to review full report at Codecov.
|
`InvocationStubber` methods cannot have return type declarations until then.
sebastianbergmann
added
the
event/code-sprint/2019-09
PHPUnit Code Sprint: September 2019
label
Sep 6, 2019
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 #3120
In practice, a
MockObject
is also aStub
, so we are just aliasing methods, but it is also true that the type-checker now does the heavy lifting for us. If people useMockObject
methods after being told explicitly that aStub
is returned, that's a type error downstream.Auto-completion now restricts methods correctly, so we're good 👍