Haehnchen / idea-php-phpunit-plugin

IntelliJ IDEA / PhpStorm PHPUnit Enhancement Plugin
MIT License
55 stars 11 forks source link

`ObjectProphecy` methods lost when passed. #62

Open tjlytle opened 3 years ago

tjlytle commented 3 years ago

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

func0der commented 3 years ago

Any news on a fix for this one?

func0der commented 1 year ago

hello, @Haehnchen ?

func0der commented 1 year ago

hello @Haehnchen ?

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