PHPStan fails on “previous major” (Drupal 10) pipeline: *EntityType attribute classes missing
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3541671. -->
Reported by: [joelpittet](https://www.drupal.org/user/160302)
Related to !49
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>The GitLab CI composer (previous major) job (Drupal 10) started failing PHPStan due to missing classes when analyzing the new attribute-based entity definitions:<br>
These attributes exist in Drupal 11 but not in Drupal 10. At runtime on D10 the attributes are ignored, but PHPStan flags them as missing.</p>
<p><a href="https://git.drupalcode.org/project/og/-/jobs/6226789">https://git.drupalcode.org/project/og/-/jobs/6226789</a></p>
<pre>Note: Using configuration file /builds/project/og/web/modules/custom/og/phpstan.neon.<br> ------ --------------------------------------------------------------------- <br> Line src/Entity/OgMembership.php <br> ------ --------------------------------------------------------------------- <br> 104 Attribute class Drupal\Core\Entity\Attribute\ContentEntityType does <br> not exist. <br> ------ --------------------------------------------------------------------- <br><br> ------ -------------------------------------------------------------------- <br> Line src/Entity/OgMembershipType.php <br> ------ -------------------------------------------------------------------- <br> 61 Attribute class Drupal\Core\Entity\Attribute\ConfigEntityType does <br> not exist. <br> ------ -------------------------------------------------------------------- <br><br> ------ -------------------------------------------------------------------- <br> Line src/Entity/OgRole.php <br> ------ -------------------------------------------------------------------- <br> 72 Attribute class Drupal\Core\Entity\Attribute\ConfigEntityType does <br> not exist. <br> ------ -------------------------------------------------------------------- <br><br> [ERROR] Found 3 errors </pre><h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>Investigate whether these are false positives. Depending on findings:</p>
<ol>
<li>Adjust the version of Drupal that the job is running against, or</li>
<li>Mute the errors in PHPStan configuration for the D10 job.</li>
</ol>
> Related issue: [Issue #3502649](https://www.drupal.org/node/3502649)
> Related issue: [Issue #3503767](https://www.drupal.org/node/3503767)
issue