phpstan-mockery icon indicating copy to clipboard operation
phpstan-mockery copied to clipboard

PHPStan reports error when using alternative syntax of shouldReceive method

Open hhovakimyan opened this issue 5 years ago • 3 comments
trafficstars

Hi I am using PHPStan version 0.12.2 and phpstan/phpstan-mockery version 0.12.3. My code looks like this:

$validatorMock = \Mockery::spy('alias:' . Validator::class);
$validatorMock->shouldReceive(['isValueValid' => false]);

I am mocking Validator class, which has static method isValueValid. And PHPStan reports error:

Parameter #1 ...$methodNames of method Mockery\LegacyMockInterface::shouldReceive() expects string, array<string, false> given.

However when I change the syntax to $validatorMock->shouldReceive('isValueValid')->andReturn(false); PHPStan does not report an error then. Must be this problem fixed in this package or not?

hhovakimyan avatar Mar 19 '20 08:03 hhovakimyan

must be fixed here

adaamz avatar Oct 21 '20 09:10 adaamz

Any progress on this?

braaibander avatar Nov 12 '20 10:11 braaibander

Can you at least send a failing test here?

ondrejmirtes avatar Nov 12 '20 10:11 ondrejmirtes