Skip to content

Map to readonly class #9

Open
Open
@HrjSnz

Description

@HrjSnz

Hello,

i have question. Is possible somehow map to readonly class ? How i can see it use only setters after instance is created. But is there some feature or way how map it to constructor class for make it readonly ?

readonly class PaymentCreatedDto
{
    public function __construct(
        private string $paymentUrl,
        private string $paymentStatus,
    ) {
    }

    public function getPaymentUrl(): string
    {
        return $this->paymentUrl;
    }

    public function getPaymentStatus(): string
    {
        return $this->paymentStatus;
    }
}

Thanks !

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