Skip to content

Commit 7d17216

Browse files
committed
Fix wrong signature for DateInterval::createFromDateString in 8.3+ #14479
1 parent 17d02e6 commit 7d17216

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

resources/functionMap_php83delta.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
'new' => [
2424
'DateTime::modify' => ['static', 'modify'=>'string'],
2525
'DateTimeImmutable::modify' => ['static', 'modify'=>'string'],
26+
'DateInterval::createFromDateString' => ['DateInterval', 'time'=>'string'],
2627
'str_decrement' => ['non-empty-string', 'string'=>'non-empty-string'],
2728
'str_increment' => ['non-falsy-string', 'string'=>'non-empty-string'],
2829
'gc_status' => ['array{running:bool,protected:bool,full:bool,runs:int,collected:int,threshold:int,buffer_size:int,roots:int,application_time:float,collector_time:float,destructor_time:float,free_time:float}'],
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php // lint >= 8.3
2+
3+
namespace Bug14479Php83;
4+
5+
use function PHPStan\Testing\assertType;
6+
7+
function test(string $input) {
8+
assertType(\DateInterval::class, \DateInterval::createFromDateString($input));
9+
}
10+
11+
function test2() {
12+
assertType('*NEVER*', \DateInterval::createFromDateString('foo'));
13+
}

0 commit comments

Comments
 (0)