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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot prophesize interface with final return. #463

Open
bendavies opened this issue Jan 13, 2020 · 5 comments
Open

Cannot prophesize interface with final return. #463

bendavies opened this issue Jan 13, 2020 · 5 comments

Comments

@bendavies
Copy link
Contributor

Prophesizing this class will result in could not reflect class Symfony\Component\Messenger\Envelope as it is marked final.

cc @ciaranmcnulty

@stof
Copy link
Member

stof commented Jan 13, 2020

Please share more details about this. A reproducer would help.

@bendavies
Copy link
Contributor Author

bendavies commented Jan 14, 2020

@stof sorry for the lack of detail. it was following a conversation with Ciaran in slack.

Turns out this causes the problem:
$bus->dispatch(...)->shouldBeCalled();
need to manaully specify the return to work around:
$bus->dispatch(...)->shouldBeCalled()->willReturn(new Envelope(...));

@ciaranmcnulty
Copy link
Member

We should handle this case explicitly

@stof
Copy link
Member

stof commented Jan 14, 2020

Well, we might need to report a better error message indeed. But I don't see a way to avoid forcing to define the return value. If the method call requires returning a value and we cannot return a double, we will always need to require the dev to provide a return value.

@ciaranmcnulty
Copy link
Member

Yeah I just mean an error message that's friendlier

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants