Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

#3120 implemented `TestCase#createStub()` #3810


Copy link

Ocramius commented Sep 6, 2019

Fixes #3120

In practice, a MockObject is also a Stub, so we are just aliasing methods, but it is also true that the type-checker now does the heavy lifting for us. If people use MockObject methods after being told explicitly that a Stub is returned, that's a type error downstream.

Auto-completion now restricts methods correctly, so we're good 馃憤

Ocramius added 3 commits Sep 6, 2019
鈥 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 added 4 commits 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.

This comment has been minimized.

Copy link

codecov bot commented Sep 6, 2019

Codecov Report

Merging #3810 into master will increase coverage by 0.06%.
The diff coverage is 100%.

Impacted file tree graph

@@             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
Impacted Files Coverage 螖 Complexity 螖
.../Framework/MockObject/Builder/InvocationMocker.php 85.85% <酶> (酶) 34 <0> (酶) 猬囷笍
src/Framework/TestCase.php 80.79% <100%> (+0.04%) 338 <1> (+1) 猬嗭笍
src/TextUI/ResultPrinter.php 97.72% <0%> (+0.45%) 78% <0%> (酶) 猬囷笍
src/TextUI/Command.php 70.97% <0%> (+0.82%) 212% <0%> (酶) 猬囷笍

Continue to review full report at Codecov.

Legend - Click here to learn more
螖 = absolute <relative> (impact), 酶 = not affected, ? = missing data
Powered by Codecov. Last update d02c67b...2894f1e. Read the comment docs.

Ocramius added 3 commits Sep 6, 2019
`InvocationStubber` methods cannot have return type declarations until
@sebastianbergmann sebastianbergmann merged commit 1f5e133 into sebastianbergmann:master Sep 6, 2019
3 checks passed
3 checks passed
codecov/patch 100% of diff hit (target 82.5%)
codecov/project 82.56% (+0.06%) compared to d02c67b
continuous-integration/travis-ci/pr The Travis CI build passed
@Ocramius Ocramius deleted the Ocramius:feature/#3120-stubs-implementation branch Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can鈥檛 perform that action at this time.