[WIP] Support for Prophecy#1
Closed
Jean85 wants to merge 4 commits intophpstan:masterfrom
Jean85:master
Closed
Conversation
Member
|
Hi, there's already an extension for that 😊 https://github.com/Jan0707/phpstan-prophecy Discussed in depth here: phpstan/phpstan#586 Feel free to check out if it does the job better or worse than yours and try to join forces with the author 😊 |
Contributor
Author
|
Damn, I missed that! |
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.
Reading phpstan/phpstan#134 and wanting to try PHPStan 0.9, I wanted to try to write the extension to make PHPStan and Prophecy work along.
I'm not an expert on PHPStan internals, so I started working on this copypasting from the MockBuilder classes, and I reached a point where the
reveal()method is no longer an issue for PHPStan! 🎉Now, I need to tackle the issues reported when defining the expectation on a mock, and that's a lot trickier!
Scenario:
Basically you can call on the mock any method of it's base class (
ObjectProphecy) but also any method of the mocked class (methodA); the problem is that those methods will accept the same stuff defined bu the original signature ORTokenInterfaces from Prophecy, OR a mix of that.; also, it will return aMethodProphecyevery time.How we should tackle this?