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

Mocking public properties gives undefined property error

Open olivernybroe opened this issue 1 year ago • 0 comments
trafficstars

When creating a mock and setting a property on the mock, which is the recommended way for mocking public properties, it gives an undefined property error.

$user = Mockery::mock(User::class);
$user->name = "Oliver";
Access to an undefined property Mockery\MockInterface::$name. 

current workaround is to just add the following ignore error

        - '#Access to an undefined property Mockery\\MockInterface::\$.*\.#'

olivernybroe avatar Jul 16 '24 12:07 olivernybroe