Skip to content

Avoid addMethod issue with stdClass #93

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

Closed
wants to merge 2 commits into from

Conversation

VincentLanglet
Copy link
Contributor

Since the tests are written with phpunit@7, I used setMethods().
But the issue also exists with addMethods()

Comment on lines 29 to 32
/**
* @phpstan-return MockBuilder
*/
public function setMethods(array $methods = null) {}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ondrejmirtes I thought this would have fixed #87

I would have expect that the MockBuilder will lose his template param

$this->getMockBuilder(Bar::class)

would be MockBuilder so

$this->getMockBuilder(Bar::class)->getMock()

would be MockObject&Bar but I wanted that

$this->getMockBuilder(Bar::class)->setMethods(...)

become something like MockBuilder so

$this->getMockBuilder(Bar::class)->setMethods(...)->getMock()

become MockObject&mixed and every method are allowed

This could be maybe a first step for solving the issue.
But it seems like I'm doing this wrong...

@VincentLanglet VincentLanglet changed the title Add failing test Avoid addMethod issue with stdClass Mar 23, 2021
@VincentLanglet VincentLanglet marked this pull request as ready for review March 23, 2021 17:02
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

Successfully merging this pull request may close these issues.

1 participant