Skip to content

[6.x] Element compatibility improvements#18790

Merged
riasvdv merged 6 commits into6.xfrom
feature/element-compat
May 6, 2026
Merged

[6.x] Element compatibility improvements#18790
riasvdv merged 6 commits into6.xfrom
feature/element-compat

Conversation

@riasvdv
Copy link
Copy Markdown
Contributor

@riasvdv riasvdv commented May 5, 2026

Description

Improves compatibility provided by the yii2-adapter with a small trade-off of having an empty trait for every element in the main codebase that gets overridden by the adapter.

  • The main codebase defines a LegacyConstants trait which only gets defined when the class in the namespace doesn't exist yet
  • The adapter when installed loads constants/ with the same base namespace as the main package which defines the traits that are used by the main codebase and makes the legacy constants available on the new class
  • The old classes are class_alias'ed to the new classes, retaining any legacy constant and event functionality

This reduces method signature and return type mismatches for plugins relying on the legacy element classes.

@semanticdiff-com
Copy link
Copy Markdown

semanticdiff-com Bot commented May 5, 2026

Review changes with  SemanticDiff

Changed Files
File Status
  src/Address/Concerns/LegacyConstants.php Unsupported file format
  src/Address/Elements/Address.php Unsupported file format
  src/Asset/Concerns/LegacyConstants.php Unsupported file format
  src/Asset/Elements/Asset.php Unsupported file format
  src/Element/Concerns/LegacyNestedElementManager.php Unsupported file format
  src/Element/NestedElementManager.php Unsupported file format
  src/Entry/Concerns/LegacyConstants.php Unsupported file format
  src/Entry/Elements/Entry.php Unsupported file format
  src/Field/Elements/Concerns/LegacyConstants.php Unsupported file format
  src/Field/Elements/ContentBlock.php Unsupported file format
  src/User/Concerns/LegacyConstants.php Unsupported file format
  src/User/Elements/User.php Unsupported file format
  yii2-adapter/composer.json  0% smaller
  yii2-adapter/constants/Address/Concerns/LegacyConstants.php Unsupported file format
  yii2-adapter/constants/Asset/Concerns/LegacyConstants.php Unsupported file format
  yii2-adapter/constants/Element/Concerns/LegacyNestedElementManager.php Unsupported file format
  yii2-adapter/constants/Entry/Concerns/LegacyConstants.php Unsupported file format
  yii2-adapter/constants/Field/Elements/Concerns/LegacyConstants.php Unsupported file format
  yii2-adapter/constants/User/Concerns/LegacyConstants.php Unsupported file format
  yii2-adapter/legacy/base/Element.php Unsupported file format
  yii2-adapter/legacy/elements/Address.php Unsupported file format
  yii2-adapter/legacy/elements/Asset.php Unsupported file format
  yii2-adapter/legacy/elements/ContentBlock.php Unsupported file format
  yii2-adapter/legacy/elements/Entry.php Unsupported file format
  yii2-adapter/legacy/elements/NestedElementManager.php Unsupported file format
  yii2-adapter/legacy/elements/User.php Unsupported file format
  yii2-adapter/src/Mixins/UserMixin.php Unsupported file format
  yii2-adapter/tests-laravel/Behavior/LegacyBehaviorCompatibilityTest.php Unsupported file format

@riasvdv riasvdv requested a review from brandonkelly May 5, 2026 18:00
@riasvdv riasvdv marked this pull request as ready for review May 5, 2026 18:00
@riasvdv riasvdv merged commit ed3c413 into 6.x May 6, 2026
16 checks passed
@riasvdv riasvdv deleted the feature/element-compat branch May 6, 2026 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant