Currently in Psalm there exists the psalm-mutation-free and psalm-pure annotations to denote that a method can not perform certain form of side effects.
I would find useful an annotation to denote the fact that a class method is pure when considered as a function from its input and the class state.
This would allow to ensure that the only side effect of a method is accessing the state of the class. Moreover, if the class had all its promerties marked as readonly, then subsequent calls of a method on the same instance of the class would give the same result.
Currently in Psalm there exists the
psalm-mutation-free
andpsalm-pure
annotations to denote that a method can not perform certain form of side effects.I would find useful an annotation to denote the fact that a class method is pure when considered as a function from its input and the class state.
This would allow to ensure that the only side effect of a method is accessing the state of the class. Moreover, if the class had all its promerties marked as
readonly
, then subsequent calls of a method on the same instance of the class would give the same result.