Skip to content

Fix wrong signature for DateInterval::createFromDateString in 8.3+#5483

Open
sunkan wants to merge 2 commits intophpstan:2.1.xfrom
sunkan:bug-14479
Open

Fix wrong signature for DateInterval::createFromDateString in 8.3+#5483
sunkan wants to merge 2 commits intophpstan:2.1.xfrom
sunkan:bug-14479

Conversation

@sunkan
Copy link
Copy Markdown

@sunkan sunkan commented Apr 16, 2026

Fixes phpstan/phpstan#14479

Summary

In php8.3 the signature changed from

DateInterval::createFromDateString(string $datetime): DateInterval|false

to

DateInterval::createFromDateString(string $datetime): DateInterval

now it instead throws an DateMalformedStringException

Reference: https://www.php.net/manual/en/dateinterval.createfromdatestring.php


This pr collides with the fix for phpstan/phpstan#8442 but I don't know how to solve that.

@ondrejmirtes
Copy link
Copy Markdown
Member

The linked issue is closed. Please first create an issue from one of the templates at https://github.com/phpstan/phpstan/issues/new/choose and provide a failing playground example.

@sunkan
Copy link
Copy Markdown
Author

sunkan commented Apr 16, 2026

I did use the "Function signature mismatch"

And it says

<!-- Please send a pull request in phpstan/phpstan-src that updates file resources/functionMap.php instead. Thank you. -->

@VincentLanglet
Copy link
Copy Markdown
Contributor

VincentLanglet commented Apr 16, 2026

Exemple of the issue https://phpstan.org/r/213cc168-576f-49eb-b1e3-f32de3fdf0bd

The DateIntervalDynamicReturnTypeExtension need to be updated too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants