Problem/Motivation

On PHP 7.4 + Drupal 9, the module fatals during install/config import with:
ParseError: syntax error, unexpected 'static' (T_STATIC) in
src/Service/ScriptFileManager.php. The return type : static requires PHP ≥ 8.0.
Many Drupal 9 sites still run on PHP 7.4; this is a regression for those environments.

Steps to reproduce

  1. Environment example:
    • Drupal 9.x (e.g. 9.5.x)
    • PHP 7.4.x (CLI and FPM)
  2. Install/Config import via Drush:
    drush si --existing-config -y
  3. Observe fatal error:
    ParseError: syntax error, unexpected 'static' (T_STATIC) in .../src/Service/ScriptFileManager.php on line 77

Proposed resolution

Change the method return type from static to self and update the docblock. This restores PHP 7.4 compatibility while remaining valid on PHP 8+.

Remaining tasks

  • (Optional) Add a simple test/build job on PHP 7.4 to prevent regressions for D9 users.

User interface changes

None.

API changes

None.

Data model changes

None.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

truls1502 created an issue. See original summary.

truls1502’s picture

Status: Active » Needs review

  • atowl committed 1f768b27 on 8.x-1.x authored by truls1502
    Issue #3540831 by truls1502: Fix PHP 7.4 compatibility: replace static...
atowl’s picture

Status: Needs review » Fixed

Thanks @truls1502,

have merged this in for the next release.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.