Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Sep 12, 2024
1 parent 51fae3c commit 55b879a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ public function dataDivisionByMaybeZero(): iterable
],
[
'Binary operation "/" between int and -5|int<0, max> might result in an error.',
115,
123,
],
],
];
Expand Down Expand Up @@ -930,7 +930,7 @@ public function dataDivisionByMaybeZero(): iterable
],
[
'Binary operation "/" between int and -5|int<0, max> might result in an error.',
115,
123,
],
],
];
Expand Down
16 changes: 12 additions & 4 deletions tests/PHPStan/Rules/Operators/data/invalid-division.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function throws(int $i, int $x) {
return $i / $x;
};

class DivideFloats
class Divide
{
public function doDiv(int $y, float $x): void
{
Expand All @@ -99,12 +99,20 @@ public function doDiv2(int $y, $benevolentMaybeFloat): void
}

/**
* @param __benevolent<int|true> $benevolentMaybeString
* @param __benevolent<int|true> $benevolent
*/
public function doDiv3(int $y, $benevolentMaybeString): void
public function doDiv3(int $y, $benevolent): void
{
echo $y / $benevolentMaybeString;
echo $y / $benevolent;
}

/**
* @param __benevolent<float|true> $benevolent
*/
public function doDiv4(int $y, $benevolent): void
{
echo $y / $benevolent;
}
}

/**
Expand Down

0 comments on commit 55b879a

Please sign in to comment.