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:
- Symbol (e.g., function, method) exists.
- Symbol does not
@seeitself. (Example: #2621516: hook_page_attachments_alter() @see's itself instead of hook_page_attachments())
Comments
Comment #2
traviscarden commentedComment #3
quietone commentedComment #4
quietone commentedComment #5
klausiI 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.