Skip to content

Commit f9a6538

Browse files
committed
Test accepting numeric strings
1 parent 842b468 commit f9a6538

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

tests/PHPStan/Levels/data/acceptTypes-5.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,5 +198,15 @@
198198
"message": "Parameter #1 $min (340) of function random_int expects lower number than parameter #2 $max (int<min, 339>).",
199199
"line": 685,
200200
"ignorable": true
201+
},
202+
{
203+
"message": "Parameter #1 $numericString of method Levels\\AcceptTypes\\NumericStrings::doBar() expects string&numeric, 'foo' given.",
204+
"line": 707,
205+
"ignorable": true
206+
},
207+
{
208+
"message": "Parameter #1 $numericString of method Levels\\AcceptTypes\\NumericStrings::doBar() expects string&numeric, string given.",
209+
"line": 708,
210+
"ignorable": true
201211
}
202212
]

tests/PHPStan/Levels/data/acceptTypes.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,3 +693,27 @@ public function doStuff(): void
693693
}
694694

695695
}
696+
697+
class NumericStrings
698+
{
699+
700+
/**
701+
* @param string $string
702+
* @param numeric-string $numericString
703+
*/
704+
public function doFoo(string $string, string $numericString): void
705+
{
706+
$this->doBar('1');
707+
$this->doBar('foo');
708+
$this->doBar($string);
709+
$this->doBar($numericString);
710+
}
711+
712+
/**
713+
* @param numeric-string $numericString
714+
*/
715+
public function doBar(string $numericString): void
716+
{
717+
718+
}
719+
}

0 commit comments

Comments
 (0)