,error_levels?:string[]}> */ public function providerValidCodeParse(): iterable { return [ 'intRangeContained' => [ ' $a * @return int<-1, max> */ function scope(int $a){ return $a; }', ], 'positiveIntRange' => [ ' $a * @return positive-int */ function scope(int $a){ return $a; }', ], 'intRangeToInt' => [ ' $a * @return int */ function scope(int $a){ return $a; }', ], 'intReduced' => [ '= 500); assert($a < 5000); assert($b >= -5000); assert($b < -501); assert(-60 > $c); assert(-500 < $c);', 'assertions' => [ '$a===' => 'int<500, 4999>', '$b===' => 'int<-5000, -502>', '$c===' => 'int<-499, -61>', ] ], 'intOperations' => [ '= 500); assert($a < 5000); $b = $a % 10; $c = $a ** 2; $d = $a - 5; $e = $a * 1;', 'assertions' => [ '$b===' => 'int<0, 9>', '$c===' => 'int<250000, 24990001>', '$d===' => 'int<495, 4994>', '$e===' => 'int<500, 4999>' ] ], 'SKIPPED-intLoopPositive' => [ ' [ '$i===' => 'int<0, 9>' ] ], 'SKIPPED-intLoopNegative' => [ ' 1; $i--){ }', 'assertions' => [ '$i===' => 'int<2, 10>' ] ], 'integrateExistingArrayPositive' => [ ' */ function getInt() { return 7; } $_arr = ["a", "b", "c"]; $a = getInt(); $_arr[$a] = 12;', 'assertions' => [ '$_arr===' => 'non-empty-array, "a"|"b"|"c"|12>' ] ], 'integrateExistingArrayNegative' => [ ' */ function getInt() { return -2; } $_arr = ["a", "b", "c"]; $a = getInt(); $_arr[$a] = 12;', 'assertions' => [ '$_arr===' => 'non-empty-array, "a"|"b"|"c"|12>' ] ], 'SKIPPED-statementsInLoopAffectsEverything' => [ ' [ '$remainder===' => 'int' ] ], 'SKIPPED-IntRangeRestrictWhenUntouched' => [ ' 1) { takesInt($i); } } /** @psalm-param int<2, 3> $i */ function takesInt(int $i): void{ return; }', ], 'SKIPPED-wrongLoopAssertion' => [ ' 0 && rand(0,1)) { continue; } /** @psalm-trace $i */; $type_tokens[$i] = ""; /** @psalm-trace $type_tokens */; if($i > 1){ $type_tokens[$i - 2]; } } return []; } /** @return array */ function getArray(): array{ return []; }' ] ]; } /** * @return iterable */ public function providerInvalidCodeParse(): iterable { return [ 'intRangeNotContained' => [ ' $a * @return int<-1, 11> * @psalm-suppress InvalidReturnStatement */ function scope(int $a){ return $a; }', 'error_message' => 'InvalidReturnType', ], ]; } }