From 597ea135a88e9b2a6a6ea52ab8f8dca2c890563e Mon Sep 17 00:00:00 2001 From: "narendra.desai" <narendra.desai@acquia.com> Date: Fri, 11 Oct 2024 15:56:25 +0530 Subject: [PATCH] Coding standards. --- src/Controller/TermRevisionController.php | 15 ++++++- src/Form/TermRevisionDeleteForm.php | 17 +++++--- src/Form/TermRevisionRevertForm.php | 49 ++++++++++++++--------- taxonomy_term_revision.info.yml | 6 +-- taxonomy_term_revision.module | 2 +- 5 files changed, 61 insertions(+), 28 deletions(-) diff --git a/src/Controller/TermRevisionController.php b/src/Controller/TermRevisionController.php index 4517e43..437527e 100644 --- a/src/Controller/TermRevisionController.php +++ b/src/Controller/TermRevisionController.php @@ -91,7 +91,20 @@ class TermRevisionController extends ControllerBase { protected DateFormatterInterface $dateFormatter; /** - * {@inheritdoc} + * Constructs a new TermRevisionController. + * + * @param \Drupal\Core\Database\Connection $database + * Database connection. + * @param \Drupal\user\UserStorageInterface $user_storage + * User storage. + * @param \Drupal\taxonomy\TermStorageInterface $term_storage + * Term storage. + * @param \Drupal\Core\Entity\EntityRepository $entity_repository + * Entity repository. + * @param \Drupal\Core\Entity\EntityViewBuilderInterface $term_view_builder + * Term view builder. + * @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter + * Date formatter. */ public function __construct(Connection $database, UserStorageInterface $user_storage, TermStorageInterface $term_storage, EntityRepository $entity_repository, EntityViewBuilderInterface $term_view_builder, DateFormatterInterface $date_formatter) { $this->database = $database; diff --git a/src/Form/TermRevisionDeleteForm.php b/src/Form/TermRevisionDeleteForm.php index 3bc9a4f..25ba3bf 100644 --- a/src/Form/TermRevisionDeleteForm.php +++ b/src/Form/TermRevisionDeleteForm.php @@ -23,21 +23,21 @@ class TermRevisionDeleteForm extends ConfirmFormBase { * * @var string */ - protected $id; + protected string $id; /** * The entity id. * * @var string */ - protected $entityId; + protected string $entityId; /** * The database connection. * * @var \Drupal\Core\Database\Connection */ - protected $database; + protected Connection $database; /** * The logger instance. @@ -51,10 +51,17 @@ class TermRevisionDeleteForm extends ConfirmFormBase { * * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ - protected $entityTypeManager; + protected EntityTypeManagerInterface $entityTypeManager; /** - * Constructor. + * Constructs a new TermRevisionDeleteForm. + * + * @param \Drupal\Core\Database\Connection $database + * Database connection. + * @param \Drupal\Core\Logger\LoggerChannelFactoryInterface $logger_factory + * Logger factory. + * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager + * Entity type manager. */ public function __construct(Connection $database, LoggerChannelFactoryInterface $logger_factory, EntityTypeManagerInterface $entity_type_manager) { $this->database = $database; diff --git a/src/Form/TermRevisionRevertForm.php b/src/Form/TermRevisionRevertForm.php index a0fc8de..0252449 100644 --- a/src/Form/TermRevisionRevertForm.php +++ b/src/Form/TermRevisionRevertForm.php @@ -2,14 +2,14 @@ namespace Drupal\taxonomy_term_revision\Form; -use Drupal\Component\Datetime\Time; +use Drupal\Component\Datetime\TimeInterface; use Drupal\Core\Database\Connection; -use Drupal\Core\Datetime\DateFormatter; -use Drupal\Core\Entity\EntityTypeManager; +use Drupal\Core\Datetime\DateFormatterInterface; +use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Form\ConfirmFormBase; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Logger\LoggerChannelFactoryInterface; -use Drupal\Core\Session\AccountProxy; +use Drupal\Core\Session\AccountProxyInterface; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\Core\Url; use Drupal\taxonomy\TermInterface; @@ -26,21 +26,21 @@ class TermRevisionRevertForm extends ConfirmFormBase { * * @var string */ - protected $id; + protected string $id; /** * The entity id. * * @var string */ - protected $entityId; + protected string $entityId; /** * The database connection. * * @var \Drupal\Core\Database\Connection */ - protected $database; + protected Connection $database; /** * The logger instance. @@ -52,35 +52,48 @@ class TermRevisionRevertForm extends ConfirmFormBase { /** * The time details. * - * @var \Drupal\Component\Datetime\Time + * @var \Drupal\Component\Datetime\TimeInterface */ - protected $time; + protected TimeInterface $time; /** * The entity type manager. * - * @var \Drupal\Core\Entity\EntityTypeManager + * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ - protected $entityTypeManager; + protected EntityTypeManagerInterface $entityTypeManager; /** * User definition. * - * @var \Drupal\Core\Session\AccountProxy + * @var \Drupal\Core\Session\AccountProxyInterface */ - protected $currentUser; + protected AccountProxyInterface $currentUser; /** * The date formatter. * - * @var \Drupal\Core\Datetime\DateFormatter + * @var \Drupal\Core\Datetime\DateFormatterInterface */ - protected $dateFormatter; + protected DateFormatterInterface $dateFormatter; /** - * Constructor. - */ - public function __construct(Connection $database, LoggerChannelFactoryInterface $loggerFactory, Time $time, EntityTypeManager $entityTypeManager, AccountProxy $current_user, DateFormatter $date_formatter) { + * Constructs a new TermRevisionRevertForm. + * + * @param \Drupal\Core\Database\Connection $database + * Database connection. + * @param \Drupal\Core\Logger\LoggerChannelFactoryInterface $loggerFactory + * Logger factory. + * @param \Drupal\Component\Datetime\TimeInterface $time + * Time service. + * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager + * Entity type manager. + * @param \Drupal\Core\Session\AccountProxyInterface $current_user + * Current user. + * @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter + * Date formatter. + */ + public function __construct(Connection $database, LoggerChannelFactoryInterface $loggerFactory, TimeInterface $time, EntityTypeManagerInterface $entityTypeManager, AccountProxyInterface $current_user, DateFormatterInterface $date_formatter) { $this->database = $database; $this->loggerFactory = $loggerFactory; $this->time = $time; diff --git a/taxonomy_term_revision.info.yml b/taxonomy_term_revision.info.yml index 0590dc8..3ad5479 100644 --- a/taxonomy_term_revision.info.yml +++ b/taxonomy_term_revision.info.yml @@ -4,8 +4,8 @@ description: 'Allows user to revert or delete taxonomy term revisions.' type: module package: revision -core_version_requirement: ^8 || ^9 || ^10 || ^11 +core_version_requirement: ^8.8 || ^9 || ^10 || ^11 dependencies: - - drupal:system (>= 8.7) - - drupal:taxonomy (>=8.7) + - drupal:system (>= 8.8) + - drupal:taxonomy (>=8.8) diff --git a/taxonomy_term_revision.module b/taxonomy_term_revision.module index 1b640f0..d2ab4f6 100644 --- a/taxonomy_term_revision.module +++ b/taxonomy_term_revision.module @@ -2,7 +2,7 @@ /** * @file - * Taxonomy Term Revision module. + * Drupal Module: Taxonomy Term Revision. */ use Drupal\Core\Entity\EntityInterface; -- GitLab