bug: #3633496: ResourceFieldEnhancerBase triggers return type deprecations on Drupal 12

Closes #3633496

Generated with the help of an LLM.

Problem

On Drupal 12, DebugClassLoader reports three deprecations for ResourceFieldEnhancerBase. Its getInternalValidator(), getInputValidator() and getOutputValidator() implement the Shaper interfaces but declare no return type. Every test that loads an enhancer gets these three notices, so a Drupal 12 run fails on deprecations even when all assertions pass.

Change

Each of the three methods gets a @return \Shaper\Validator\ValidateableInterface tag. The change is docblock only, so the code does not change. A native return type would also remove the notices, but it would break any subclass that overrides these methods without one.

Testing

  • Drupal 12.0.0-beta2, PHP 8.5: Geofield's GeofieldGeoJsonEnhancerTest, which extends this base class, reports three deprecations without this change and none with it.
  • The patch applies to 8.x-3.x at ca6afab and to 3.28.0.

Related: #3591308 (Drupal 12 bot issue).

Merge request reports

Loading
Loading