PHP 8.0 compatibility

Created on 21 March 2022, over 2 years ago
Updated 31 August 2024, 3 months ago

Problem/Motivation

I am trying to check for errors via phpcs and PHPCompatibility standard on a drupal project, here is the command:

phpcs -p /MODULE/ --standard=PHPCompatibility --runtime-set testVersion 8.0 --extensions=php,module,inc,install,test,profile,theme

The command works fine. However, I am supposed to receive following error

"FILE: /contrib/content_sync/src/Form/ContentImportTrait.php
----------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------------------------------------------------
  55 | WARNING | Declaring a required parameter after an optional one is deprecated since PHP 8.0. Parameter $serializer_context is optional, while parameter $context is required.
 116 | WARNING | Declaring a required parameter after an optional one is deprecated since PHP 8.0. Parameter $serializer_context is optional, while parameter $context is required.
----------------------------------------------------------------------------------------------------------------


FILE: /content_sync/src/Form/ContentExportTrait.php
----------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------
 85 | WARNING | Declaring a required parameter after an optional one is deprecated since PHP 8.0. Parameter $serializer_context is optional, while parameter $context is required.
----------------------------------------------------------------------------------------------------------------"

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

RTBC

Version

3.0

Component

Code

Created by

🇨🇳China eugeney

Live updates comments and jobs are added and updated live.
  • PHP 8.0

    The issue particularly affects sites running on PHP version 8.0.0 or later.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024