statamic / cms

The core Laravel CMS Composer package
https://statamic.com
Other
4.11k stars 538 forks source link

[5.x] PHP 8.4 Support #11114

Open duncanmcclean opened 1 week ago

duncanmcclean commented 1 week ago

This pull request adds PHP 8.4 support.

Statamic itself is compatible with PHP 8.4, however, some packages we're using still need to be updated to support it, otherwise users may see deprecation notices.

duncanmcclean commented 5 days ago

When you run the test suite locally, you'll see a couple of deprecation warnings from Carbon:

Deprecated: Carbon\Traits\Date::getDaysFromStartOfWeek(): Implicitly marking parameter $weekStartsAt as nullable is deprecated, the explicit nullable type must be used instead in /Users/duncan/Code/Statamic/cms/vendor/nesbot/carbon/src/Carbon/Traits/Date.php on line 1394

Deprecated: Carbon\Traits\Date::setDaysFromStartOfWeek(): Implicitly marking parameter $weekStartsAt as nullable is deprecated, the explicit nullable type must be used instead in /Users/duncan/Code/Statamic/cms/vendor/nesbot/carbon/src/Carbon/Traits/Date.php on line 1412

Deprecated: Carbon\Traits\Date::utcOffset(): Implicitly marking parameter $minuteOffset as nullable is deprecated, the explicit nullable type must be used instead in /Users/duncan/Code/Statamic/cms/vendor/nesbot/carbon/src/Carbon/Traits/Date.php on line 1481

Deprecated: Carbon\Traits\Localization::locale(): Implicitly marking parameter $locale as nullable is deprecated, the explicit nullable type must be used instead in /Users/duncan/Code/Statamic/cms/vendor/nesbot/carbon/src/Carbon/Traits/Localization.php on line 447

Deprecated: Carbon\Traits\Test::setDefaultTimezone(): Implicitly marking parameter $date as nullable is deprecated, the explicit nullable type must be used instead in /Users/duncan/Code/Statamic/cms/vendor/nesbot/carbon/src/Carbon/Traits/Test.php on line 203

Deprecated: Return type of Carbon\Traits\Date::createFromTimestamp($timestamp, $tz = null) should either be compatible with DateTime::createFromTimestamp(int|float $timestamp): static, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/duncan/Code/Statamic/cms/vendor/nesbot/carbon/src/Carbon/Traits/Timestamp.php on line 29

Deprecated: Carbon\CarbonTimeZone::toOffsetName(): Implicitly marking parameter $date as nullable is deprecated, the explicit nullable type must be used instead in /Users/duncan/Code/Statamic/cms/vendor/nesbot/carbon/src/Carbon/CarbonTimeZone.php on line 158

Deprecated: Carbon\CarbonTimeZone::toOffsetTimeZone(): Implicitly marking parameter $date as nullable is deprecated, the explicit nullable type must be used instead in /Users/duncan/Code/Statamic/cms/vendor/nesbot/carbon/src/Carbon/CarbonTimeZone.php on line 172

Deprecated: Carbon\CarbonTimeZone::toRegionName(): Implicitly marking parameter $date as nullable is deprecated, the explicit nullable type must be used instead in /Users/duncan/Code/Statamic/cms/vendor/nesbot/carbon/src/Carbon/CarbonTimeZone.php on line 188

Deprecated: Carbon\CarbonTimeZone::toRegionTimeZone(): Implicitly marking parameter $date as nullable is deprecated, the explicit nullable type must be used instead in /Users/duncan/Code/Statamic/cms/vendor/nesbot/carbon/src/Carbon/CarbonTimeZone.php on line 230

These deprecations have been addressed in Carbon 3, however upgrading to Carbon 3 would involve breaking changes.

We might have to live with the deprecation warnings for now until we can upgrade in Statamic 6.

duncanmcclean commented 5 days ago

If you have GraphQL enabled, you'll see a bunch of deprecation warnings from the thecodingmachine/safe package (which is used by graphql-laravel). I've subscribed to various PRs in that package, hoping one of them will get merged soon. 🤞

Unfortunatley, deprecation warnings prevent the Control Panel from working. 😬

crynobone commented 4 days ago

These deprecations have been addressed in Carbon 3, however upgrading to Carbon 3 would involve breaking changes.

You might want to manually require ^3.4 on CI for PHP 8.4 build, this solved the issue on laravel/framework

jasonvarga commented 3 days ago

Thank you!

duncanmcclean commented 3 days ago

Thanks, @crynobone!