Skip to content

Commit d60cc3d

Browse files
committed
Update bug-7858.php
1 parent ce34267 commit d60cc3d

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

tests/PHPStan/Analyser/nsrt/bug-7858.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,27 @@ function bar(int $year): void
1919
}
2020
assertType('int<2022, max>', $year);
2121
}
22+
23+
function baz($year): void
24+
{
25+
if (!ctype_digit($year) || (int)$year < 2022) {
26+
throw new \RuntimeException();
27+
}
28+
assertType('int<2022, max>|numeric-string', $year);
29+
}
30+
31+
function bam(int|string $year): void
32+
{
33+
if (!ctype_digit($year) || (int)$year < 2022) {
34+
throw new \RuntimeException();
35+
}
36+
assertType('int<2022, max>|numeric-string', $year);
37+
}
38+
39+
function ban(string $year): void
40+
{
41+
if (!ctype_digit($year) || (int)$year < 2022) {
42+
throw new \RuntimeException();
43+
}
44+
assertType('numeric-string', $year);
45+
}

0 commit comments

Comments
 (0)