Problem/Motivation

A recent commit to solve some deprecation warnings is not compatible with Drupal < 8.7.

There is a fatal error on any administration page:

Fatal error: Interface 'Drupal\Component\Plugin\ConfigurableInterface' not found in /app/web/modules/contrib/password_policy/src/PasswordConstraintInterface.php on line 12

This is because ConfigurableInterface, which replaces ConfigurablePluginInterface, is only available since Drupal 8.7.

Proposed resolution

The module has a dependency on Drupal >= 8.5 - if we want to maintain that compatibility, we can't update to ConfigurableInterface just yet. We'll need to keep the reference to ConfigurablePluginInterface until closer to Drupal 9.

The alternative is to bump up the core version required to 8.7. Our site, and probably lots of others, are still running 8.6, so that's not ideal. :(

See the change record for this deprecation, and the note at the bottom re: compatibility.

Comments

tallytarik created an issue. See original summary.

aohrvetpv’s picture

Thanks for the bug report. Sounds like we could implement both, per the note you referenced.

aohrvetpv’s picture

I couldn't figure out how to implement both ConfigurableInterface and ConfigurablePluginInterface as the change record suggests. Any ideas?

tallytarik’s picture

That suggestion is actually quite confusing! I thought it was referring to compatibility with older versions of core, but that can't be the case. It seems impossible to implement ConfigurableInterface while maintaining compatibility with core < 8.7 because the class will never exist.

The solution looks like reverting to ConfigurablePluginInterface until core 8.5 and 8.6 are no longer supported.

That looks like the approach that some other contrib modules have taken:
https://www.drupal.org/project/views_bulk_operations/issues/3048199
https://www.drupal.org/project/flag/issues/3035815
https://www.drupal.org/project/rules/issues/3030291

aohrvetpv’s picture

I will plan to revert if it is indeed impossible to implement both. Either it is possible or the note on the change record is wrong, it seems. I will try to reach out to the authors of that change record.

Looks like only 8.6.x and 8.7.x are currently supported. 8.6.x security support is planned to end in December, so ConfigurablePluginInterface could be dropped then.
https://www.drupal.org/core/release-cycle-overview

Incidentally, I think the ">=8.5" in the info.yml could be removed since no version below 8.5.x is supported.

aohrvetpv’s picture

I conversed with mikelutz, the author of the note at the bottom of the change record. He said it was possible to implement both using interface_exists(), class_alias(), etc.

However, I will plan to revert the relevant changes from #3042612: Drupal 9 Deprecated Code Report and postpone switching to ConfigurableInterface until Drupal 8.6 is end-of-life.

I wanted to implement both interfaces to eliminate deprecation exceptions, which were causing the build to fail since phpcs: halt-on-fail was set to true in drupalci.yml. drupalci.yml has since been removed though because it was causing a problem (see #3056710: Add drupalci.yml). Implementing both interfaces is now not as useful, and we would still want to remove the implementation of the deprecated interface later.

aohrvetpv’s picture

Status: Active » Needs review
StatusFileSize
new883 bytes
aohrvetpv’s picture

  • AohRveTPV committed b7f5d40 on 8.x-3.x
    Issue #3061382 by AohRveTPV: ConfigurableInterface does not exist in...
aohrvetpv’s picture

Status: Needs review » Fixed

Tests passed on D8.6 and D8.7. Thanks.

Status: Fixed » Closed (fixed)

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