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

Magic Prophecy methods should accept argument tokens for any argument

Open stof opened this issue 7 years ago • 4 comments

Currently, using a Prophecy argument token when writing a Prophecy mock triggers a warning about invalid type. Instead, all magic mock method should have their arguments accepting their original argument type OR \Prophecy\Argument\Token\TokenInterface

stof avatar Nov 28 '17 14:11 stof

Note that #12 is a subset of this case (specifically for one particular kind of token)

stof avatar Nov 28 '17 14:11 stof

I have been issuing a similar problem with the folks at PHPStorm on their issue tracker and they referred me back to this plugin and we closed the issue as won't fix.

You can follow this issue here: https://youtrack.jetbrains.com/issue/WI-38593.

There is a sample project that I made that clarifies the situation where it shows that using Argument::any() or Argument::type(SomeClass::class) will trigger a warning. Like @stof said It would be nice if also Argument::type() would cleverly check for what is being given as argument in order to respect type hinting.

srosato avatar Dec 21 '17 16:12 srosato

@Haehnchen any plan to work on a fix for this issue ?

stof avatar Apr 23 '20 12:04 stof

Great stuff! Works really well.

Should I file a) one or b) two separate issues for the following?

  1. Argument::type('null')
  2. Argument::exact and Argument::is

InvisibleSmiley avatar Apr 27 '20 13:04 InvisibleSmiley