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

Magic Prophecy methods should accept argument tokens for any argument #29

Open
stof opened this issue Nov 28, 2017 · 4 comments
Open

Magic Prophecy methods should accept argument tokens for any argument #29

stof opened this issue Nov 28, 2017 · 4 comments
Labels

Comments

@stof
Copy link

stof commented Nov 28, 2017

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
Copy link
Author

stof commented Nov 28, 2017

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

@srosato
Copy link

srosato commented Dec 21, 2017

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.

@stof
Copy link
Author

stof commented Apr 23, 2020

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

Haehnchen added a commit that referenced this issue Apr 24, 2020
Haehnchen added a commit that referenced this issue Apr 24, 2020
Haehnchen added a commit that referenced this issue Apr 24, 2020
Haehnchen added a commit that referenced this issue Apr 24, 2020
support Argument::any (Prophecy\Argument\Token\TokenInterface) type resolving based on prophecy class context #12 #29
@InvisibleSmiley
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants