Problem/Motivation
When using "phpcs" I found some "hint" errors I believe are related to FullyQualifiedNamespace problem.
For example, I found this in 'core/lib/Drupal/Core/Entity/entity.api.php' file:
925 | ERROR | [ ] Expected type hint "EntityInterface"; found
| | "Drupal\Core\Entity\EntityInterface" for
| | $entity
But the file does not have any "use Drupal\Core\Entity\EntityInterface;" statement.
Taking a closer look in this file I realize that another class sometimes uses a FQN sometimes don't.
Example:
"if ($entity instanceof \Drupal\Core\Entity\ContentEntityInterface && !$entity->foo->value) {"
and
"if ($entity instanceof ContentEntityInterface && $entity->isTranslatable()) {"
Then I started looking for similar problems in other places and got:
find . -type f \( -name '*.inc' -or -name '*.module' -or -name '*.php' \) -exec grep -e '\((\|, \|instanceof \)Drupal\\Core' {} \+ | cut -f1 -d':' | uniq
./core/modules/tour/tour.api.php
./core/modules/quickedit/quickedit.api.php
./core/lib/Drupal/Core/Database/database.api.php
./core/lib/Drupal/Core/Database/StatementInterface.php
./core/lib/Drupal/Core/StreamWrapper/StreamWrapperManagerInterface.php
./core/lib/Drupal/Core/Entity/entity.api.php
I propose to use the "use Drupal\Core\;" statement to fix this problem.
Steps to reproduce
TBA
Proposed resolution
Either adjust Drupal.Classes.FullyQualifiedNamespace to identify problems in *.api.php or create a new sniff?
Remaining tasks
Determine what sniff reported the errors above
TBA