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.
The attribute accepts no arguments.
<?php
use PhpStaticAnalysis\Attributes\IsReadOnly;
class IsReadOnlyExample
{
#[IsReadOnly] // this property cannot be written to
public string $name;
...
}