Open shulard opened 4 years ago
+1
I am also looking to add autocomplete for prophecy but it seems it is not as easy as other libraries/frameworks. It looks like prophecy is using a lot of "magic" (reference).
+1
Is there any status update on this?
+1
+1
+1
+1
nothing?
FWIW I was able to at least avoid a ton of intelephense detected errors like this:
use Prophecy\ObjectBehavior;
// ...
/**
* @param ObjectBehavior<MyDependency> $myDependency
*/
public function it_does_something(
MyDependency $myDependency
): void {
// no more errors! Autocomplete gets a bit confused, but no errors is worth it IMHO.
$myDependency->doThing()->shouldBeCalledOnce()->willReturn(true);
// ...
}
Feature description or problem with existing feature
I'm using your extension for a while now but I have trouble when using PHPSpec + Prophecy because it miss specific method understanding (even on the premium version).
As you can see in the following picture, most of the assertions methods are marked unknown :
Describe the solution you'd like
Since inside a spec file, every object injected in methods is constructed as a mock ("prophet" in the Prophecy world), it's not a real instance. Every method exists but must be configured with assertions / expectations. All the
willReturn
,shouldBeXXX
are valid.Same for the current object instance, when using
$this
every method for the currently specified object is available and the return value is a spy object that can be tested.I don't know if you are familiar with these tools, I can help if necessary :smile:.