Skip to content
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

[5.x] PHP 8.4 Support #11114

Draft
wants to merge 33 commits into
base: 5.x
Choose a base branch
from
Draft

[5.x] PHP 8.4 Support #11114

wants to merge 33 commits into from

Conversation

duncanmcclean
Copy link
Member

@duncanmcclean duncanmcclean commented Nov 12, 2024

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.

Otherwise, we'll see deprecation warnings when running the `prefer-lowest` tests with PHP 8.4.
Otherwise, we'll see deprecation warnings when running the `prefer-lowest` tests with PHP 8.4.
Due to another PR preventing deprecation warnings: laravel/framework#50922
Only 1.41.2 and above is compatible with PHP 8.4, otherwise we get deprecation warnings which throws off one of our tests.

Related: https://github.com/spatie/ray/releases/tag/1.41.2

Since `spatie/laravel-ray` doesn't specify a minimum version, we're having to specify it here.
@duncanmcclean
Copy link
Member Author

duncanmcclean commented Nov 20, 2024

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
Copy link
Member Author

duncanmcclean commented Nov 20, 2024

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. 😬

The "lowest" versions of dependencies throw deprecation errors with PHP 8.4 - we only want to test with the latest versions for now.

This means we also don't need to adjust the minimum versions of dependencies.

This is what Laravel does in their test suite.
we shouldn't need this after Laravel's PHP 8.4 PR has been merged
@crynobone
Copy link
Contributor

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
Copy link
Member

Thank you!

@duncanmcclean
Copy link
Member Author

Thanks, @crynobone!

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