Skip to content

Latest commit

 

History

History
25 lines (16 loc) · 472 Bytes

IsReadOnly.md

File metadata and controls

25 lines (16 loc) · 472 Bytes

IsReadOnly Attribute

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;
    
    ...
}