Skip to content

Commit

Permalink
Test accepting numeric strings
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Oct 15, 2020
1 parent 842b468 commit f9a6538
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/PHPStan/Levels/data/acceptTypes-5.json
Original file line number Diff line number Diff line change
Expand Up @@ -198,5 +198,15 @@
"message": "Parameter #1 $min (340) of function random_int expects lower number than parameter #2 $max (int<min, 339>).",
"line": 685,
"ignorable": true
},
{
"message": "Parameter #1 $numericString of method Levels\\AcceptTypes\\NumericStrings::doBar() expects string&numeric, 'foo' given.",
"line": 707,
"ignorable": true
},
{
"message": "Parameter #1 $numericString of method Levels\\AcceptTypes\\NumericStrings::doBar() expects string&numeric, string given.",
"line": 708,
"ignorable": true
}
]
24 changes: 24 additions & 0 deletions tests/PHPStan/Levels/data/acceptTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -693,3 +693,27 @@ public function doStuff(): void
}

}

class NumericStrings
{

/**
* @param string $string
* @param numeric-string $numericString
*/
public function doFoo(string $string, string $numericString): void
{
$this->doBar('1');
$this->doBar('foo');
$this->doBar($string);
$this->doBar($numericString);
}

/**
* @param numeric-string $numericString
*/
public function doBar(string $numericString): void
{

}
}

0 comments on commit f9a6538

Please sign in to comment.