Skip to content

Tag reference

@psalm-mutation-free

The @psalm-mutation-free tag declares that a method never mutates any state, whether observable from outside the object or purely internal to it.

Grammar

"@psalm-mutation-free" [ <Description> ]

Examples

A method that changes no state at all.
/**
* @psalm-mutation-free
*/
public function getName(): string

Names by platform

psalm
@psalm-mutation-free

Parsing a @psalm-mutation-free tag produces a PsalmMutationFreeTag instance. Being a pure marker, it adds nothing beyond the $name and optional $description every Tag already carries.

final class PsalmMutationFreeTag extends FlagTag {}

Defined by Psalm’s supported annotations reference.