Skip to content

Immutable object properties must be immutable objects #5

@svnldwg

Description

@svnldwg

If a class has a property of type object which is declared immutable and accessible from outside (public or via getter), the object itself must be immutable as well.

Example:

/** @var immutable */
class Immutable
{
    public Cat $cat;
}

class Cat {
    public int $lala; // not allowed here, Cat must be immutable
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions