Skip to content

Commit

Permalink
Merge pull request #7089 from marcosh/abs-should-return-positive-int
Browse files Browse the repository at this point in the history
  • Loading branch information
weirdan authored Dec 7, 2021
2 parents 2530b33 + 9c4187f commit a1b5e48
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion stubs/CoreGenericFunctions.phpstub
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ function gettimeofday(bool $as_float = false) {}
* @psalm-pure
*
* @param numeric $num
* @return ($num is int ? int : ($num is float ? float : int|float))
* @return ($num is int ? positive-int|0 : ($num is float ? float : positive-int|0|float))
*/
function abs($num) {}

Expand Down
4 changes: 2 additions & 2 deletions tests/FunctionCallTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ function fooFoo(array $a = []): void {
$c = $_GET["c"];
$c = is_numeric($c) ? abs($c) : null;',
'assertions' => [
'$a' => 'int',
'$a' => 'int|positive-int',
'$b' => 'float',
'$c' => 'float|int|null',
'$c' => 'float|int|null|positive-int',
],
'error_levels' => ['MixedAssignment', 'MixedArgument'],
],
Expand Down

0 comments on commit a1b5e48

Please sign in to comment.