Release 4.0.19+ break with PHP 7.4

Created on 11 February 2025, 2 months ago

Problem/Motivation

When upgrading my drupal 9.5 project with "composer update", drupal/environment_indicator got updated from 4.0.14 to 4.0.21. Now I get a PHP error:

ParseError: syntax error, unexpected ')', expecting variable (T_VARIABLE)
 in Composer\Autoload\{closure}()
 (line 96 of modules/contrib/environment_indicator/src/ToolbarHandler.php). 

This is because of commit 7de422f44e3234cacfdc9972b2282386e5a61156 for issue #3425788, which added a trailing comma in the constructor signature:

  public function __construct(
    ModuleHandlerInterface $module_handler,
    ConfigFactoryInterface $config_factory,
    AccountProxyInterface $account,
    StateInterface $state,
    Settings $settings,
    EntityTypeManagerInterface $entity_type_manager,
  ) {

This is not supported by PHP 7.4, which itself is supported by Drupal 9.

Unfortunately, the composer.json does not specify a PHP version constraint.

Proposed resolution

Release a new 4.x version with PHP 7.4 support, or declare the PHP version constraint in all releases since 4.0.19.

🐛 Bug report
Status

Active

Version

4.0

Component

Code

Created by

🇩🇪Germany cweiske

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

Comments & Activities

Production build 0.71.5 2024