-
-
Notifications
You must be signed in to change notification settings - Fork 934
Closed
phpstan/phpstan-src
#1335Labels
Description
Feature request
Introduce @immutable docblock annotation, similar to what Psalm offers, applicable to classes, traits and properties. The whole implementation should be a few hundreds lines of code: every property that is being assigned checks whether it or it's class/trait is marked as @immutable and, if so, throw an error. Same thing when trying to pass such a property by reference. The only exceptions are the constructor and __unserialize.
Optionally, support for unofficial #[Immutable] annotation of PHPStorm could be introduced as a fallback until there's a single standard for this.
adiletmaks, gbirke, JoyceBabu, ChrisDBrown, osorioramirez and 12 morealsar, ste93cry, adiletmaks, gbirke, osorioramirez and 3 more