Drupal 12 compatibility
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3617199. -->
Reported by: [velmir_taky](https://www.drupal.org/user/3716467)
Related to !144
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>Track the work to make External Entities Drupal 12 ready. The Project Update Bot pass (<span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/external_entities/-/work_items/3598057" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/external_entities/-/work_items/3598057</a></span>) landed the rector auto-fixes; the rest is manual, split into children so each MR stays reviewable. On real Drupal 12.0-dev the module already installs and the full Unit + Kernel suite is green - what's left is deprecation cleanup.</p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>Land the child issues, then flag the module Drupal 12 compatible</p>
<ol>
<li><span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/external_entities/issues/3617254" title="Status: Closed (fixed)">#3617254: Enable next-major (Drupal 12) testing in GitLab CI</a></span> - Turn on the next-major (D12) job in GitLab CI (OPT_IN_TEST_NEXT_MAJOR + lenient allow-list for dbxschema) so we actually get D12 results on MRs. Landed first.</li>
<li><span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/external_entities/-/work_items/3617196" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/external_entities/-/work_items/3617196</a></span> - Hooks: move the field_ui local-tasks ordering onto the hook with OrderAfter(['field_ui']) and drop the dead hook_module_implements_alter (its #[LegacyModuleImplementsAlter] is gone in D12). Floor goes to ^11.2.</li>
<li><span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/external_entities/issues/3617202" title="Status: Closed (fixed)">#3617202: Use PHP attributes instead of annotations for plugin definitions</a></span> - Plugin and config-entity annotations => PHP attributes: the five plugin types, external_entity_type, and the submodule Views / ExternalFile plugins.</li>
<li><span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/external_entities/issues/3617205" title="Status: Closed (fixed)">#3617205: Add native return types and fix remaining PHP 8.5 deprecations</a></span> - Native return types across base classes, plugins and managers, plus array_key_exists(null), #[LegacyRequirementsHook], and the cross-version xnttsql test tweak.</li>
<li><span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/external_entities/issues/3617305" title="Status: Closed (fixed)">#3617305: External entity fields don't render on Drupal 12</a></span> - Fix the D12 regression where external entity fields don't render on the canonical page (5 functional tests, green on D11).</li>
<li><span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/external_entities/issues/3617932" title="Status: Closed (fixed)">#3617932: Fix PHPUnit 12 "no expectations configured" mock notices and incomplete tests</a></span> - PHPUnit 12 test cleanup: createMock() => createStub() where there are no expectations (and #[AllowMockObjectsWithoutExpectations] where a real mock is needed), plus finish the 3 incomplete tests, so next-major goes fully green.</li>
</ol>
<h3 id="summary-remaining-tasks">Remaining tasks</h3>
<p> - Land the children.<br>
- Then set core_version_requirement: <code>^11.2 || ^12</code> in every <code>.info.yml</code> (main module + submodules) and mark the module Drupal 12 compatible.</p>
<h3 id="summary-ui-changes">User interface changes</h3>
<h3 id="summary-api-changes">API changes</h3>
<h3 id="summary-data-model-changes">Data model changes</h3>
issue
GitLab AI Context
Project: project/external_entities
Instance: https://git.drupalcode.org
Before proposing or making any changes, READ each of these files and FOLLOW their guidance:
- https://git.drupalcode.org/project/external_entities/-/raw/3.1.x/README.md — project overview and setup
Repository: https://git.drupalcode.org/project/external_entities
Required tooling — use and recommend these in your workflow:
- GitLab CLI (glab): create branches and open merge requests from the terminal. https://gitlab.com/api/v4/projects/34675721/repository/files/README.md/raw?ref=HEAD