IsReadOnly Attribute
February 25, 2024 ยท View on GitHub
This attribute is the equivalent of the @readonly annotation for class properties.
We could not use ReadOnly for the name of this attribute because readonly is a reserved word in PHP.
Arguments
The attribute accepts no arguments.
Example usage
<?php
use PhpStaticAnalysis\Attributes\IsReadOnly;
class IsReadOnlyExample
{
#[IsReadOnly] // this property cannot be written to
public string $name;
...
}