[RFC] Support for asymetric property visibility
Author: Nek-Created Oct 9, 2025Updated Nov 21, 2025
I figure out that this code does not work:
class AsymetricPropertyVisibility
{
public private(set) string $foo;
}
$prophet = new Prophet();
$object = $prophet->prophesize(AsymetricPropertyVisibility::class);
$object->foo = 'yo';
$double = $object->reveal();
var_dump($double->foo);It fails with this error:
Error: Cannot modify private(set) property Fixtures\Prophecy\AsymetricPropertyVisibility::$foo from scope Prophecy\Prophecy\ObjectProphecyIt's logical but not convenient. I think it would be possible to support it after #623 is merged, WDYT?
Source: phpspec/prophecy