- Issue created by @bbu23
- @bbu23 opened merge request.
The current implementation of ExportType
and ImportType
classes (both being config entity types) in the module relies on Annotation (@ConfigEntityType
) to define their metadata. While functional, the modern PHP approach for such metadata declaration is through PHP Attributes (introduced in PHP 8.0). Drupal Core has adopted this change for config entity types in version 11.1.0:
https://www.drupal.org/node/3505422 →
.
Adopting PHP Attributes offers several benefits, including improved code readability, better IDE support (e.g., easier navigation and refactoring), and a more declarative syntax that is native to the PHP language.
However, a direct replacement of Annotations with Attributes would break backwards compatibility for Drupal installations running on older versions than 11.1.0.
To address this, we should update the ExportType
and ImportType
ConfigEntityType definitions to utilize PHP Attributes while retaining the existing Annotation definitions for backwards compatibility.
This approach ensures that:
- PHP Attributes for defining the ConfigEntityType metadata will be available for Drupal sites running on version 11.1.0 and above.
- For sites running on Drupal versions 10.2.x and above, the existing Annotation-based metadata definition will continue to be used as a fallback, ensuring backwards compatibility.
Active
4.0
Code