Skip to content

Tag reference

@readonly-allow-private-mutation

The @readonly-allow-private-mutation tag allows a readonly property to be mutated from within the declaring class, rather than only during initialization.

Grammar

"@phpstan-readonly-allow-private-mutation" [ <Description> ]
"@psalm-readonly-allow-private-mutation" [ <Description> ]

Examples

A readonly property the class itself may change.
/**
* @readonly
* @phpstan-readonly-allow-private-mutation
*/
public array $items = [];

Names by platform

phpstan
@phpstan-readonly-allow-private-mutation
psalm
@psalm-readonly-allow-private-mutation