idea-php-phpunit-plugin icon indicating copy to clipboard operation
idea-php-phpunit-plugin copied to clipboard

`ObjectProphecy` methods lost when passed.

Open tjlytle opened this issue 5 years ago • 3 comments

When a prophecy is used in the same method, the plugin seems to help PhpStorm understand that the return types of the mocked object are actually returning method prophecies, as autocomplete works fine, and there are no complaints about the method:

image

However, if the ObjectProphecy is returned from another method, PhpStorm complains about something. When returning with no type declaration:

Here the complaint is Method 'willReturn' not found in bool image

Declaring ObjectProphecy as the return type:

Here the complaint is Method 'isEnterprise' not found in \Prophecy\Prophecy\ObjectProphecy image

Declaring ObjectProphecy as the return type and annotating @return ObjectProphecy|MemberSubscription:

Same complaint about it being a bool. image

A hacky workaround is just adding this line (even though the variable is never used, as it's redefined later in the method), but then all the complaints go away:

(And of course the EA plugin complains about that) image

tjlytle avatar Aug 19 '20 15:08 tjlytle

Any news on a fix for this one?

func0der avatar Feb 02 '21 10:02 func0der

hello, @Haehnchen ?

func0der avatar Jul 11 '22 13:07 func0der

hello @Haehnchen ?

This plugin claims Prophecy support, but this does not work. Could you elaborate to what extend Prophecy is "supported"?

func0der avatar Mar 07 '23 13:03 func0der