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

Support PHP 8.2 #4085

Merged
merged 25 commits into from Jan 30, 2024
Merged

Support PHP 8.2 #4085

merged 25 commits into from Jan 30, 2024

Conversation

paul-m
Copy link
Contributor

@paul-m paul-m commented Dec 20, 2023

This PR mainly does the following:

  • Use PHP 8.2-compatible versions of dependencies in composer.json.
  • Add PHP 8.2 to the testing matrix.

We then use a local dev environment and CI test results to adjust the following categories of changes to avoid deprecation messages:

  • Explicitly declare class properties rather than using dynamic properties.
  • Annotate a return type on JsonSerializable::jsonSerialize().

We also take the opportunity to update rector.php. This brings our codebase up to snuff for PHP 7.4, and conservatively ends up making these changes:

  • Ternary to NULL-Coalescing operators
  • $this->staticMethod() to self::staticMethod() conversions.
  • list() to [$item, $item2] conversion.
  • Fully-qualified class name to imported class name conversion.

It's important to note that if you look at the test results for the PHP 8.2 environment in this CI, you'll see deprecation messages like this:

Deprecated: Creation of dynamic property Drupal\Core\TypedData\TypedData@anonymous::$value is deprecated in /var/www/html/docroot/core/lib/Drupal/Core/TypedData/TypedData.php on line 102

This is a known issue for Drupal core, seen here: https://www.drupal.org/project/drupal/issues/3368250

This led to a 'workaround' PR to fix a test: #4104

@paul-m paul-m marked this pull request as ready for review January 29, 2024 18:41
Copy link
Member

@dafeder dafeder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Awesome work everyone

@dafeder dafeder merged commit a4fdb23 into 2.x Jan 30, 2024
13 checks passed
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.

None yet

2 participants