Skip to content
Merged
Prev Previous commit
Next Next commit
more int range tests
  • Loading branch information
staabm committed Jul 13, 2024
commit 93ce92a50e35d6c5cf45a705753f14464b43523a
6 changes: 5 additions & 1 deletion tests/PHPStan/Analyser/nsrt/bug-7387.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,16 @@ public function specifiers(int $i) {
/**
* @param positive-int $posInt
* @param negative-int $negInt
* @param int<1, 5> $nonZeroIntRange
* @param int<-1, 5> $intRange
*/
public function positionalArgs($mixed, int $i, float $f, string $s, int $posInt, int $negInt) {
public function positionalArgs($mixed, int $i, float $f, string $s, int $posInt, int $negInt, int $nonZeroIntRange, int $intRange) {
// https://3v4l.org/vVL0c
assertType('numeric-string', sprintf('%2$14s', $mixed, $i));
assertType('non-falsy-string&numeric-string', sprintf('%2$14s', $mixed, $posInt));
assertType('non-falsy-string&numeric-string', sprintf('%2$14s', $mixed, $negInt));
assertType('non-falsy-string', sprintf('%2$14s', $mixed, $intRange)); // could be numeric-string
assertType('non-falsy-string', sprintf('%2$14s', $mixed, $nonZeroIntRange)); // could be non-falsy-string&numeric-string

assertType('numeric-string', sprintf('%2$.14F', $mixed, $i));
assertType('numeric-string', sprintf('%2$.14F', $mixed, $f));
Expand Down