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

Mocking objects containing intersection type hints not working #1172

Closed
programmador opened this issue Apr 6, 2022 · 1 comment
Closed

Comments

@programmador
Copy link

For example if You have an object

class MyClass {
  __construct(TypeA & TypeB $arg) {}
}

then while trying to mock it:

new \Mockery::mock(MyClass::class)

You will encounter an error:

Error: Call to undefined method ReflectionIntersectionType::getName()

As Mockery is a PHPUnit wrapper it should be actually possible.
Currently as a fallback I use native PHPUnit mocks and it works.
Probably PHPUnit 9.5 supports mocking such types starting from this sebastianbergmann/phpunit#4932
In my case 9.5.20 is ok. I don't know into which exact version was the abovementioned support backported.

@ghostwriter
Copy link
Member

resolved via #1164

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

2 participants