Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Immutable object properties must be immutable objects #5

Open
svnldwg opened this issue Oct 28, 2020 · 0 comments
Open

Immutable object properties must be immutable objects #5

svnldwg opened this issue Oct 28, 2020 · 0 comments

Comments

@svnldwg
Copy link
Owner

svnldwg commented Oct 28, 2020

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
}
@svnldwg svnldwg changed the title Immutable object properties Immutable object properties must be immutable objects Oct 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant