Add Drupal 12 compatibility on a new 3.x branch, dropping Drupal 9 and 10
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3618359. -->
Reported by: [mably](https://www.drupal.org/user/3375160)
Related to !17
>>>
<h3>Problem/Motivation</h3>
<p>The module declares <code>core_version_requirement: ^9 || ^10 || ^11</code>. Drupal 9 reached end of life in November 2023, and the GitLab CI templates only reach one major version back, so the Drupal 9 claim cannot be tested at all. Drupal 12 is now in development, and two things this module carries will not survive it.</p>
<p>Supporting Drupal 10 keeps the test suite on PHPUnit 9, which Drupal 10.6 ships. That blocks two attributes: <code>#[Group]</code>, whose class does not exist there, which makes the <code>phpstan (previous major)</code> job fail; and <code>#[RunTestsInSeparateProcesses]</code>, whose absence Drupal 11.3 already deprecates for functional test classes and which becomes an exception in Drupal 12.</p>
<p>Supporting Drupal 9 and 10 is also the only reason the CKEditor 4 code path exists. CKEditor 4 left core in Drupal 10 and lives on in the contrib ckeditor module, which declares <code>^9.4 || ^10</code> and <code>lifecycle: deprecated</code>. A branch supporting Drupal 11 and 12 cannot reach that path at any version.</p>
<h3>Proposed resolution</h3>
<p>Open a 3.x branch requiring <code>^11.2 || ^12</code>, and remove what the older major versions required.</p>
<ul>
<li>Set <code>core_version_requirement</code> to <code>^11.2 || ^12</code> in the info file, and in <code>composer.json</code> set <code>drupal/core</code> to the same and require PHP 8.3 or higher, which is what those core versions need.</li>
<li>Remove the CKEditor 4 branch from <code>js/textfield_counter.js</code>, with its <code>CKEDITOR</code> global, its dictionary words, its test, and the <code>drupal/ckeditor</code> development dependency and lenient allow list entry that let the previous major lane exercise it.</li>
<li>Add <code>#[RunTestsInSeparateProcesses]</code> and <code>#[Group]</code> to the FunctionalJavascript tests.</li>
<li>Convert the five widget plugins from the <code>@FieldWidget</code> annotation to the <code>#[FieldWidget]</code> attribute, which is deprecated and removed in Drupal 13.</li>
<li>Convert <code>hook_help()</code> to a <code>#[Hook]</code> class, if that attribute is available in Drupal 11.2.</li>
<li>Set <code>OPT_IN_TEST_NEXT_MAJOR</code> and <code>OPT_IN_TEST_PREVIOUS_MINOR</code>, and drop <code>OPT_IN_TEST_PREVIOUS_MAJOR</code>, whose previous major would be a version this branch no longer supports.</li>
</ul>
<h3>Remaining tasks</h3>
<p>Confirm whether the <code>#[Hook]</code> attribute exists in Drupal 11.2, since the floor rests on it. Note that no CI lane tests 11.2 itself: the templates cover the current version, the adjacent minors and the neighboring majors, so the floor is a claim rather than a verified fact.</p>
<p><span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/textfield_counter/-/work_items/3618283" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/textfield_counter/-/work_items/3618283</a></span> should land on 2.x first, since the new branch starts from it. Drupal 12 is still a development branch, so its lane is allowed to fail and compatibility means green against that branch rather than against a release.</p>
<h3>User interface changes</h3>
<p>None.</p>
<h3>API changes</h3>
<p>The CKEditor 4 integration is removed, and Drupal 9 and 10 are no longer supported. Sites on those versions stay on 2.x.</p>
<h3>Data model changes</h3>
<p>None.</p>
<p>AI-Generated: Yes (Claude Code was used to help draft this issue summary. I reviewed it before posting; there is no code on this issue yet.)</p>
issue
GitLab AI Context
Project: project/textfield_counter
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/textfield_counter/-/raw/2.x/README.md — project overview and setup
Repository: https://git.drupalcode.org/project/textfield_counter
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