Problem/Motivation

There are @see references in Drupal core to something that no longer exists in core.

An @see reference that does not exit.
\Drupal\Core\TypedData\ListInterface has this line and that class does not exist.
* @see \Drupal\Core\TypedData\ListDefinitionInterface

An @see reference that does exit.
\Drupal\Tests\Core\Database\Stub\StubPDO has this line which does exist.

@see Drupal\Core\Database\Connection

Steps to reproduce

Proposed resolution

Create a code check or sniff to verify that within a @see reference that an internal reference to a function or class method actually exists. Because the code will need to perform the equivalent of calls to function_exists() or method_exists(), this may require an addition to the Coder Review rather than a code sniff.

Tests:

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Comments

Lars Toomre created an issue. See original summary.

traviscarden’s picture

Issue summary: View changes
quietone’s picture

Issue summary: View changes
quietone’s picture

klausi’s picture

I think this is not possible in PHPCS or Coder, as it does not build a full function reference list of the code base.

PHPStan does that and can also parse comments, so I would suggest to open an issue at https://github.com/mglaman/phpstan-drupal and try to implement it there.