Skip to content

Fix for Laravels Carbon becoming stricter on return types. #641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 4, 2025

Conversation

aebian
Copy link
Contributor

@aebian aebian commented Aug 3, 2025

Carbon became stricter about return type compatibility I think. The DateBase type that worked before was no longer accepted, but ?static is the proper return type that Carbon expects for late static binding.

Error I recieved:

NOTICE: PHP message: PHP Fatal error: Declaration of October\Rain\Support\Date::createFromFormat($format, $time, $timezone = null): ?Carbon\Carbon must be compatible with Carbon\Carbon::createFromFormat($format, $time, $timezone = null): ?static in /var/www/html/vendor/october/rain/src/Support/Date.php on line 24
NOTICE: PHP message: PHP Fatal error: Uncaught Error: Class "October\Rain\Support\Date" not found in /var/www/html/vendor/laravel/framework/src/Illuminate/Support/DateFactory.php:248

The fix in my pull request fixed the issue for all of my octobercms sites.
Thanks.

@daftspunk daftspunk merged commit df57006 into octobercms:4.x Aug 4, 2025
@daftspunk
Copy link
Member

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants