Remove deprecated API usage now that Drupal 11.2+ is required
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3622372. -->
Reported by: [jrockowitz](https://www.drupal.org/user/371407)
Related to !319
>>>
<p>AI-assisted by Codex</p>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>Schema.org Blueprints and Schema.org Blueprints Experimental require Drupal 11.2 or later, but both projects still contain deprecated API calls and compatibility code whose replacements are available in Drupal 11.2. Broad PHPStan suppressions for deprecated functions and methods currently prevent new deprecations from failing static analysis.</p>
<p>An unsuppressed PHPStan scan on Drupal 11.4.6 reports 13 direct deprecated calls: nine introduced by Drupal 11.4, three introduced by Drupal 11.3, and one introduced by Symfony 7.4. The Drupal 11.4 findings are four <code>check_markup()</code> calls, three <code>filter_formats()</code> calls, and the experimental project's <code>_filter_autop()</code> and <code>filter_default_format()</code> calls.</p>
<p>A manual and runtime-deprecation scan also finds Drupal 11.2 entity-original and database fetch-mode compatibility code, five project-owned special hook implementations that need legacy-hook attributes, and deprecated PHPUnit docblock metadata. There are 419 PHPUnit metadata annotations across 224 test files, and 211 integration test classes need the separate-process attribute.</p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<ul>
<li>Add <code>SchemaDotOrgMarkupHelper::checkMarkup()</code> and replace all four direct <code>check_markup()</code> calls with the shared helper.</li>
<li>Add <code>SchemaDotOrgMarkupFilterHelper</code> to centralize filter-format option lookup, default-format lookup, and automatic paragraph filtering. Replace <code>filter_formats()</code>, <code>filter_default_format()</code>, and <code>_filter_autop()</code> through this helper in both projects.</li>
<li>Replace direct <code>$entity-&gt;original</code> access with <code>getOriginal()</code> and <code>setOriginal()</code>.</li>
<li>Use <code>FetchAs::Associative</code> directly and remove the obsolete database compatibility wrapper and <code>DeprecationHelper</code> use.</li>
<li>Replace <code>node_is_page()</code> with canonical-route or view-mode checks, <code>FileSystemInterface::basename()</code> with native <code>basename()</code>, and deprecated Symfony request access with the appropriate parameter bag.</li>
<li>Add <code>LegacyModuleImplementsAlter</code> to the two project-owned <code>hook_module_implements_alter()</code> implementations and <code>LegacyRequirementsHook</code> to the three project-owned requirements hook implementations. General procedural-to-OOP hook conversion remains out of scope.</li>
<li>Convert deprecated PHPUnit metadata to attributes and add <code>RunTestsInSeparateProcesses</code> where required, limited to the PHPUnit compatibility work identified by Rector and runtime scans.</li>
<li>Remove broad PHPStan deprecation suppressions and obsolete deprecation-helper suppressions so future deprecated function and method calls fail analysis.</li>
</ul>
<p>The main Schema.org Blueprints issue is the canonical tracker. Schema.org Blueprints Experimental will receive a separate linked merge request. Deprecations originating in Drupal core or other contributed dependencies are outside the scope of these project changes.</p>
<h3 id="summary-remaining-tasks">Remaining tasks</h3>
<ul>
<li>Implement and manually review the changes in both projects.</li>
<li>Add or update focused regression coverage for both markup helpers and the replaced APIs.</li>
<li>Run complete PHPUnit and code-review suites for both projects.</li>
<li>Confirm PHPStan reports no deprecated function or method use.</li>
<li>Confirm the focused Rector dry run reports no remaining PHPUnit compatibility changes.</li>
<li>Review both merge requests and CI results.</li>
</ul>
<h3 id="summary-ui-changes">User interface changes</h3>
<p>None.</p>
<h3 id="summary-api-changes">API changes</h3>
<p>Add <code>SchemaDotOrgMarkupHelper::checkMarkup()</code> and <code>SchemaDotOrgMarkupFilterHelper</code> as shared compatibility APIs. Remove the public <code>SchemaDotOrgMapping::$original</code> property; consumers must use the inherited entity <code>getOriginal()</code> and <code>setOriginal()</code> methods. Any additional services required by replacements will use autowiring.</p>
<h3 id="summary-data-model-changes">Data model changes</h3>
<p>None.</p>
issue
GitLab AI Context
Project: project/schemadotorg
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/schemadotorg/-/raw/1.0.x/README.md — project overview and setup
Repository: https://git.drupalcode.org/project/schemadotorg
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