SocialCustom plugin sources not compatible with method definition in base class

Created on 21 February 2023, almost 2 years ago

Problem/Motivation

Updating OpenSocial to version 11.7.* and using Drupal core 9.4.* requires a switch from PHP 7.4 to PHP 8.1. After the running the update process method definitions of theme plugin socialcustom are not compatible with their inherited base class definitions:

Drupal\socialcustom\Plugin\Alter\ThemeSuggestions::alter
Drupal\socialcustom\Plugin\Preprocess\Container::preprocess 
Drupal\socialcustom\Plugin\Preprocess\Html::preprocess
Drupal\socialcustom\Plugin\Preprocess\Node::preprocess
Drupal\socialcustom\Plugin\Preprocess\Page::preprocess

Error message (example):

Fatal error: Declaration of Drupal\socialcustom\Plugin\Alter\ThemeSuggestions::alter(&$suggestions, &$context = null, &$hook = null) must be compatible with Drupal\socialbase\Plugin\Alter\ThemeSuggestions::alter(&$suggestions, &$context1 = null, &$hook = null): void in /var/www/html/html/themes/custom/socialcustom/src/Plugin/Alter/ThemeSuggestions.php on line 19

Steps to reproduce

  • Upgrade Open Social to version 11.7.* (including Drupal core version 9.4.8)
  • Remove "php:7.4" dependency from composer.json
  • Update PHP runtime environment to version 8.1 (e.g. update values in DDEV config)

Proposed resolution

Add missing "void" statements for mentioned methods

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None

🐛 Bug report
Status

Closed: won't fix

Version

11.7

Component

Code (back-end)

Created by

🇩🇪Germany kretzschr

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024