Skip to content

Commit

Permalink
GetDKAN#4296: Typehint interfaces instead of concrete classes for som…
Browse files Browse the repository at this point in the history
…e services (GetDKAN#4297)
  • Loading branch information
stefan-korn authored Sep 30, 2024
1 parent b58b750 commit b2086a3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions modules/metastore/modules/metastore_search/src/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Drupal\metastore_search;

use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Entity\EntityTypeManager;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\metastore\MetastoreService;
use Drupal\search_api\Query\ResultSet;
use Drupal\search_api\Utility\QueryHelperInterface;
Expand Down Expand Up @@ -45,7 +45,7 @@ class Search implements ContainerInjectionInterface {
/**
* Entity Type Manager.
*
* @var \Drupal\Core\Entity\EntityTypeManager
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
private $entityTypeManager;

Expand All @@ -61,14 +61,14 @@ class Search implements ContainerInjectionInterface {
*
* @param \Drupal\metastore\MetastoreService $metastoreService
* Metastore service.
* @param \Drupal\Core\Entity\EntityTypeManager $entityTypeManager
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager
* Entity type manager.
* @param \Drupal\search_api\Utility\QueryHelperInterface $queryHelper
* Query helper.
*/
public function __construct(
MetastoreService $metastoreService,
EntityTypeManager $entityTypeManager,
EntityTypeManagerInterface $entityTypeManager,
QueryHelperInterface $queryHelper
) {
$this->metastoreService = $metastoreService;
Expand Down
8 changes: 4 additions & 4 deletions modules/metastore/src/NodeWrapper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace Drupal\metastore\NodeWrapper;

use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityTypeManager;
use Drupal\common\Exception\DataNodeLifeCycleEntityValidationException;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\metastore\MetastoreItemInterface;
use Drupal\node\Entity\Node;

Expand All @@ -30,7 +30,7 @@ class Data implements MetastoreItemInterface {
/**
* Entity Type Manager.
*
* @var \Drupal\Core\Entity\EntityTypeManager
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
private $entityTypeManager;

Expand All @@ -46,12 +46,12 @@ class Data implements MetastoreItemInterface {
*
* @param \Drupal\Core\Entity\EntityInterface $entity
* A Drupal entity.
* @param \Drupal\Core\Entity\EntityTypeManager $entityTypeManager
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager
* Entity Type Manager service.
*
* @throws \Drupal\common\Exception\DataNodeLifeCycleEntityValidationException
*/
public function __construct(EntityInterface $entity, EntityTypeManager $entityTypeManager) {
public function __construct(EntityInterface $entity, EntityTypeManagerInterface $entityTypeManager) {
$this->validate($entity);
$this->node = $entity;
$this->entityTypeManager = $entityTypeManager;
Expand Down
10 changes: 5 additions & 5 deletions modules/metastore/src/NodeWrapper/NodeDataFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Drupal\metastore\NodeWrapper;

use Drupal\Core\Entity\EntityRepository;
use Drupal\Core\Entity\EntityTypeManager;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\metastore\Factory\MetastoreEntityItemFactoryInterface;

/**
Expand All @@ -16,14 +16,14 @@ class NodeDataFactory implements MetastoreEntityItemFactoryInterface {
/**
* EntityRepository object.
*
* @var Drupal\Core\Entity\EntityRepository
* @var \Drupal\Core\Entity\EntityRepository
*/
private $entityRepository;

/**
* Entity Type Manager.
*
* @var Drupal\Core\Entity\EntityTypeManager
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
private $entityTypeManager;

Expand All @@ -32,10 +32,10 @@ class NodeDataFactory implements MetastoreEntityItemFactoryInterface {
*
* @param \Drupal\Core\Entity\EntityRepository $entityRepository
* The entity repository service.
* @param \Drupal\Core\Entity\EntityTypeManager $entityTypeManager
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager
* Entity Type Manager service.
*/
public function __construct(EntityRepository $entityRepository, EntityTypeManager $entityTypeManager) {
public function __construct(EntityRepository $entityRepository, EntityTypeManagerInterface $entityTypeManager) {
$this->entityRepository = $entityRepository;
$this->entityTypeManager = $entityTypeManager;
}
Expand Down
6 changes: 3 additions & 3 deletions modules/metastore/src/Storage/DataFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Contracts\FactoryInterface;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Entity\EntityTypeManager;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Psr\Log\LoggerInterface;

/**
Expand All @@ -22,7 +22,7 @@ class DataFactory implements FactoryInterface {
/**
* Entity type manager service.
*
* @var \Drupal\Core\Entity\EntityTypeManager
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
private $entityTypeManager;

Expand All @@ -44,7 +44,7 @@ class DataFactory implements FactoryInterface {
* Constructor.
*/
public function __construct(
EntityTypeManager $entityTypeManager,
EntityTypeManagerInterface $entityTypeManager,
ConfigFactoryInterface $config_factory,
LoggerInterface $loggerChannel
) {
Expand Down

0 comments on commit b2086a3

Please sign in to comment.