Issue summary generated with the help of an LLM.

Problem/Motivation

PHPStan currently flags several class.notFound errors across Drupal core where a @return PHPDoc annotation specifies a class is not found. This mostly points to misnamed FQN.

Those are candidates for easy fixes, and also remove some related issues from the baseline automatically.

Proposed resolution

  • Review all methods and functions flagged with class.notFound and fix them
  • Regenerate core/.phpstan-baseline.php to remove the resolved class.notFound entries.

Remaining tasks

  • Fix all class.notFound occurrences in core.
  • Regenerate core/.phpstan-baseline.php.
  • Verify PHPStan passes in GitLab CI.

User interface changes

None.

API changes

None.

Data model changes

None.

Issue fork drupal-3641794

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mallezie created an issue. See original summary.

mallezie’s picture

Status: Active » Needs review

Left out here are class.notFound issues in lib/Drupal/Core/Mailer
Those will need a seperate issue, since those require more non-trivial changes.

Most changes here, relate to updating incorrect phpdoc comments which reference incorrect classes.

One question here is, i've included changes for the Doctrine/Annotation fork which is pulled in drupal, might be better to ignore that component from phpstan, since this will be removed completely in D13 IIRC.