Skip to content

PHPStan reports error when using alternative syntax of shouldReceive method #15

@hhovakimyan

Description

@hhovakimyan

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions