,error_levels?:string[]}> */ public function providerValidCodeParse() { return [ 'simplePureFunction' => [ 'a === 2) { return $i; } $a = new A(); return null; }', ], ]; } /** * @return iterable */ public function providerInvalidCodeParse() { return [ 'impurePropertyAssignment' => [ 'a++; if ($i % 2 === 0 || $a->a === 2) { return $i; } return null; }', 'error_message' => 'ImpurePropertyAssignment', ], 'impureMethodCall' => [ 'a++; } } /** @psalm-pure */ function filterOdd(int $i, A $a) : ?int { $a->foo(); if ($i % 2 === 0 || $a->a === 2) { return $i; } return null; }', 'error_message' => 'ImpureMethodCall', ], 'impureFunctionCall' => [ ' 'ImpureFunctionCall', ], 'impureConstructorCall' => [ 'a++; } } /** @psalm-pure */ function filterOdd(int $i, A $a) : ?int { $b = new B($a); if ($i % 2 === 0 || $a->a === 2) { return $i; } return null; }', 'error_message' => 'ImpureMethodCall', ], ]; } }