Immutable Attribute

February 28, 2024 ยท View on GitHub

This attribute is the equivalent of the @immutable annotation for classes, traits and interfaces.

Arguments

The attribute accepts no arguments.

Example usage

<?php

use PhpStaticAnalysis\Attributes\Immutable;

#[Immutable] // All properties are readonly
class ImmutableExample
{
    ...
}