Skip to content

Commit

Permalink
Merge pull request #8583 from gphargreaves/#8484/fix-datetimeimmutabl…
Browse files Browse the repository at this point in the history
…e-sub

Correct return type of DateTimeImmutable sub method stub
  • Loading branch information
orklah committed Oct 15, 2022
2 parents dbb8815 + 8849e8c commit 9218017
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions stubs/CoreImmutableClasses.phpstub
Expand Up @@ -58,10 +58,8 @@ class DateTimeImmutable implements DateTimeInterface

/**
* @psalm-mutation-free
* @return static|false this method can fail in case an {@see DateInterval} with relative
* week days is passed in.
*
* @see https://github.com/php/php-src/blob/534127d3b22b193ffb9511c4447584f0d2bd4e24/ext/date/php_date.c#L3157-L3160
* @return static
*/
public function sub(DateInterval $interval) {}

Expand Down
2 changes: 1 addition & 1 deletion tests/MethodCallTest.php
Expand Up @@ -271,7 +271,7 @@ final class MyDate extends DateTimeImmutable {}
$b = (new DateTimeImmutable())->modify("+3 hours");',
'assertions' => [
'$yesterday' => 'MyDate|false',
'$yesterday' => 'MyDate',
'$b' => 'DateTimeImmutable',
],
],
Expand Down

0 comments on commit 9218017

Please sign in to comment.