Skip to content

[RFC] Support for asymetric property visibility #654

@Nek-

Description

@Nek-

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\ObjectProphecy

It's logical but not convenient. I think it would be possible to support it after #623 is merged, WDYT?

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