ParseError: syntax error, unexpected 'static' (T_STATIC) in PHP 7.4

Created on 23 February 2023, over 1 year ago
Updated 21 March 2023, over 1 year ago

Problem/Motivation

Enabling the workbench_email moderation in PHP 7.4 gives below error:

[2023-02-23T16:07:40.150Z] ParseError: syntax error, unexpected 'static' (T_STATIC) in Composer\Autoload\{closure}() (line 201 of /var/www/html/drupal/docroot/modules/contrib/workbench_email/src/Entity/Template.php).

[2023-02-23T16:07:40.150Z] PHP Parse error:  syntax error, unexpected 'static' (T_STATIC) in /var/www/html/drupal/docroot/modules/contrib/workbench_email/src/Entity/Template.php on line 201

[2023-02-23T16:07:40.150Z] PHP Fatal error:  Exception thrown without a stack frame in Unknown on line 0

[2023-02-23T16:07:40.150Z] 

Steps to reproduce

  • Download Drupal Core ^9.5 and Install site.
  • Make sure PHP version is 7.4.
  • Enable workbench_email module and you'll see above error.
$ composer create-project drupal/recommended-project:^9 drupal && cd drupal
$ composer require drupal/workbench_email drush/drush
$ ./vendor/bin/drush site:install minimal --yes
$ ./vendor/bin/drush en workbench_email --yes

Proposed resolution

Need to return type that's added in the function here as this has been introduced with PHP 8.0 and it's not backward compatible.

🐛 Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

🇮🇳India vishalkhode

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

Comments & Activities

Production build 0.69.0 2024