Skip to content

Tag reference

@pure

The @pure tag declares a function or method as pure, meaning it is free of side effects: calling it repeatedly with the same arguments always produces the same result, without observably mutating any state.

Grammar

"@phan-pure" [ <Description> ]
"@phpstan-pure" [ <Description> ]
"@psalm-pure" [ <Description> ]

Examples

A function without side effects.
/**
* @phan-pure
*/
function add(int $a, int $b): int

Names by platform

phan
@phan-pure
phpstan
@phpstan-pure
psalm
@psalm-pure