-
Notifications
You must be signed in to change notification settings - Fork 55
Closed
Description
Hello,
here is a problematic snippet in php 7.4:
<?php
class MyTest extends TestCase
private Object $testedObject
private $someMockedObject;
public function setUp(): void
{
$this->testedObject = new Object();
$this->someMockedObject = $this->createMock(SomeInterface::class);
}
public function testItDoesSomething(): void
{
$this->someMockedObject->expects()...
$this->testedObject->doSomething($this->someMockedObject);
}First, at level 6, phpstan complains about the property which has no typehint
Property MyTest::$someMockedObject has no typehint specified
Event if we put /* @var SomeInterface|MockObject */ it still complains.
Thus, we have to chose a type hint between MockObject or SomeInterface but it complains one way like the other because expects() method is unknown on SomeInterface or Object::doSomething() parameter 1 expects an instance of SomeInterface
any clue how i can make this pass?
thanks :)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels