Skip to content

Latest commit

 

History

History
26 lines (18 loc) · 413 Bytes

Pure.md

File metadata and controls

26 lines (18 loc) · 413 Bytes

Pure Attribute

This attribute is the equivalent of the @pure annotation for class methods and functions.

Arguments

The attribute accepts no arguments.

Example usage

<?php

use PhpStaticAnalysis\Attributes\Pure;

class PureExample
{
    #[Pure] // this function is pure
    public static function add(int $left, int $right) : int 
    {
        return $left + $right;
    }
    
  ...
}