-
Notifications
You must be signed in to change notification settings - Fork 574
Expand file tree
/
Copy pathbug-8442-83.php
More file actions
40 lines (30 loc) · 966 Bytes
/
bug-8442-83.php
File metadata and controls
40 lines (30 loc) · 966 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php // lint >= 8.3
namespace Bug8442Php83;
use stdClass;
use function PHPStan\Testing\assertType;
use DateInterval;
function () {
assertType('*NEVER*', DateInterval::createFromDateString('foo'));
assertType('DateInterval', DateInterval::createFromDateString('1 Day'));
if (rand(0,1)) {
$interval = '1 day';
} else {
$interval = '2 day';
}
assertType('DateInterval', DateInterval::createFromDateString($interval));
if (rand(0,1)) {
$interval = 'foo';
} else {
$interval = '2 day';
}
assertType('DateInterval', DateInterval::createFromDateString($interval));
if (rand(0,1)) {
$interval = 'foo';
} else {
$interval = 'foo';
}
assertType('*NEVER*', DateInterval::createFromDateString($interval));
assertType('DateInterval',DateInterval::createFromDateString(str_shuffle('1 day')));
assertType('DateInterval',DateInterval::createFromDateString());
assertType('DateInterval',DateInterval::createFromDateString(new stdClass()));
};