Replies: 1 comment 3 replies
-
This works as expected I believe: https://phpstan.org/r/f06ef7e7-6d54-4734-b45e-a05bd50adc09
|
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone!
I'm working with a mocking library that allows me to create mock objects from one or several class/interface names. My problem is that this library can't give me the good return type of the object I'm mocking and I don't know how to define the return type of the builder method, even with generics.
Let's give this simplified example: https://phpstan.org/r/5d9c49ec-1d1c-4862-8091-5a14ac7bd4fc
In this snippet, I expect:
$a
to be inferred of typeMockInterface&A
;$bcd
to be inferred of typeMockInterface&B&C&D
;$build
to be inferred of typeMockInterface&Build
;How can I acheive this by correctly defining the template or the
@return
definition of my mocker?Thanks a lot.
Beta Was this translation helpful? Give feedback.
All reactions