Skip to content

Latest commit

 

History

History
29 lines (20 loc) · 478 Bytes

Impure.md

File metadata and controls

29 lines (20 loc) · 478 Bytes

Impure Attribute

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

Arguments

The attribute accepts no arguments.

Example usage

<?php

use PhpStaticAnalysis\Attributes\Impure;

class ImpureExample
{
    public static int $i = 0;
    
    #[Impure] // this function is impure
    public static function addCumulative(int $left) : int
    {
        self::$i += $left;
        return self::$i;
    }
    
  ...
}