Issue #3567890: Remove redundant property declarations causing fatal error on Drupal 11.4

Fixes the fatal error on Drupal core 11.4:

Type of ImageFieldTokensFormatter::$currentUser must be Drupal\Core\Session\AccountInterface (as in class Drupal\image\Plugin\Field\FieldFormatter\ImageFormatter)

Changes

Removes the re-declarations of $currentUser and $imageStyleStorage from ImageFieldTokensFormatter. Both properties are inherited from core's ImageFormatter and are assigned via parent::__construct(), so the declarations in the child class are redundant.

Drupal 11.4 added native type declarations to these properties in the parent class. Since PHP property types are invariant, the untyped re-declarations now cause a fatal error on class load.

Backwards compatibility

The properties are removed rather than typed, so the change is fully compatible with Drupal 11.3 and 10.x — no version constraint changes needed.

Testing

  1. Drupal 11.4 + imagefield_tokens 3.2.0: configure an image field with the "Image Field Tokens" formatter → fatal error / HTTP 500.
  2. Apply this MR → page renders correctly, token replacement in alt/title still works.

Merge request reports

Loading