From 4c38737597b7418603d2ab995249b71e9e913bae Mon Sep 17 00:00:00 2001
From: nod_ <nod_@598310.no-reply.drupal.org>
Date: Fri, 31 Jan 2025 10:22:49 +0100
Subject: [PATCH] Issue #3491513 by quietone, smustgrave: Fix
 Drupal.Commenting.FunctionComment.Missing in views argument plugins

---
 .../src/Plugin/views/argument/UserUid.php      |  9 +++++++++
 .../node/src/Plugin/views/argument/Type.php    |  3 +++
 .../src/Plugin/views/argument/UidRevision.php  |  3 +++
 .../src/Plugin/views/argument/IndexTid.php     |  3 +++
 .../Plugin/views/argument/IndexTidDepth.php    | 12 ++++++++++++
 .../views/argument/IndexTidDepthModifier.php   |  9 +++++++++
 .../views/argument/ArgumentPluginBase.php      | 18 ++++++++++++++++++
 .../src/Plugin/views/argument/DayDate.php      |  3 +++
 .../src/Plugin/views/argument/Formula.php      |  3 +++
 .../Plugin/views/argument/GroupByNumeric.php   |  6 ++++++
 .../src/Plugin/views/argument/ManyToOne.php    | 18 ++++++++++++++++++
 .../src/Plugin/views/argument/MonthDate.php    |  3 +++
 .../src/Plugin/views/argument/NullArgument.php |  3 +++
 .../Plugin/views/argument/NumericArgument.php  | 12 ++++++++++++
 .../Plugin/views/argument/StringArgument.php   | 15 +++++++++++++++
 core/phpcs.xml.dist                            |  1 +
 16 files changed, 121 insertions(+)

diff --git a/core/modules/comment/src/Plugin/views/argument/UserUid.php b/core/modules/comment/src/Plugin/views/argument/UserUid.php
index 792b63cbe5db..22230385a2f3 100644
--- a/core/modules/comment/src/Plugin/views/argument/UserUid.php
+++ b/core/modules/comment/src/Plugin/views/argument/UserUid.php
@@ -51,6 +51,9 @@ public static function create(ContainerInterface $container, array $configuratio
     return new static($configuration, $plugin_id, $plugin_definition, $container->get('database'));
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function title() {
     if (!$this->argument) {
       $title = \Drupal::config('user.settings')->get('anonymous');
@@ -65,6 +68,9 @@ public function title() {
     return $title;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   protected function defaultActions($which = NULL) {
     // Disallow summary views on this argument.
     if (!$which) {
@@ -79,6 +85,9 @@ protected function defaultActions($which = NULL) {
     }
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function query($group_by = FALSE) {
     $this->ensureMyTable();
 
diff --git a/core/modules/node/src/Plugin/views/argument/Type.php b/core/modules/node/src/Plugin/views/argument/Type.php
index 3b6c5240bd3b..a6123b688e25 100644
--- a/core/modules/node/src/Plugin/views/argument/Type.php
+++ b/core/modules/node/src/Plugin/views/argument/Type.php
@@ -67,6 +67,9 @@ public function title() {
     return $this->node_type($this->argument);
   }
 
+  /**
+   * Returns the label for the given node type.
+   */
   public function node_type($type_name) {
     $type = $this->nodeTypeStorage->load($type_name);
     $output = $type ? $type->label() : $this->t('Unknown content type');
diff --git a/core/modules/node/src/Plugin/views/argument/UidRevision.php b/core/modules/node/src/Plugin/views/argument/UidRevision.php
index 5505b4af76b2..982152080a6b 100644
--- a/core/modules/node/src/Plugin/views/argument/UidRevision.php
+++ b/core/modules/node/src/Plugin/views/argument/UidRevision.php
@@ -15,6 +15,9 @@
 )]
 class UidRevision extends Uid {
 
+  /**
+   * {@inheritdoc}
+   */
   public function query($group_by = FALSE) {
     $this->ensureMyTable();
     $placeholder = $this->placeholder();
diff --git a/core/modules/taxonomy/src/Plugin/views/argument/IndexTid.php b/core/modules/taxonomy/src/Plugin/views/argument/IndexTid.php
index ebc76d035663..82ce8b9dc5bb 100644
--- a/core/modules/taxonomy/src/Plugin/views/argument/IndexTid.php
+++ b/core/modules/taxonomy/src/Plugin/views/argument/IndexTid.php
@@ -16,6 +16,9 @@
 )]
 class IndexTid extends ManyToOne {
 
+  /**
+   * {@inheritdoc}
+   */
   public function titleQuery() {
     $titles = [];
     $terms = Term::loadMultiple($this->value);
diff --git a/core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepth.php b/core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepth.php
index b17ce056b814..c5b5d186beaf 100644
--- a/core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepth.php
+++ b/core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepth.php
@@ -43,6 +43,9 @@ public static function create(ContainerInterface $container, array $configuratio
     );
   }
 
+  /**
+   * {@inheritdoc}
+   */
   protected function defineOptions() {
     $options = parent::defineOptions();
 
@@ -53,6 +56,9 @@ protected function defineOptions() {
     return $options;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function buildOptionsForm(&$form, FormStateInterface $form_state) {
     $form['depth'] = [
       '#type' => 'weight',
@@ -89,6 +95,9 @@ protected function defaultActions($which = NULL) {
     return $actions;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function query($group_by = FALSE) {
     $this->ensureMyTable();
 
@@ -106,6 +115,9 @@ public function query($group_by = FALSE) {
     $this->addSubQueryJoin($tids);
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function title() {
     $term = $this->entityRepository->getCanonical('taxonomy_term', $this->argument);
     if (!empty($term)) {
diff --git a/core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepthModifier.php b/core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepthModifier.php
index 10b3e87072fb..d660206f86b0 100644
--- a/core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepthModifier.php
+++ b/core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepthModifier.php
@@ -19,10 +19,19 @@
 )]
 class IndexTidDepthModifier extends ArgumentPluginBase {
 
+  /**
+   * {@inheritdoc}
+   */
   public function buildOptionsForm(&$form, FormStateInterface $form_state) {}
 
+  /**
+   * {@inheritdoc}
+   */
   public function query($group_by = FALSE) {}
 
+  /**
+   * {@inheritdoc}
+   */
   public function preQuery() {
     // We don't know our argument yet, but it's based upon our position:
     $argument = $this->view->args[$this->position] ?? NULL;
diff --git a/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php b/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php
index 18081e18e405..462ea502df8f 100644
--- a/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php
+++ b/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php
@@ -157,6 +157,9 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$
     }
   }
 
+  /**
+   * Checks if the argument has an exception.
+   */
   public function isException($arg = NULL) {
     if (!isset($arg)) {
       $arg = $this->argument ?? NULL;
@@ -164,6 +167,9 @@ public function isException($arg = NULL) {
     return !empty($this->options['exception']['value']) && $this->options['exception']['value'] === $arg;
   }
 
+  /**
+   * Returns the title of the exception for the argument.
+   */
   public function exceptionTitle() {
     // If title overriding is off for the exception, return the normal title.
     if (empty($this->options['exception']['title_enable'])) {
@@ -183,6 +189,9 @@ public function needsStylePlugin() {
     return !empty($info['style plugin']) || !empty($validate_info['style plugin']);
   }
 
+  /**
+   * {@inheritdoc}
+   */
   protected function defineOptions() {
     $options = parent::defineOptions();
 
@@ -227,6 +236,9 @@ public static function trustedCallbacks() {
     return $callbacks;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function buildOptionsForm(&$form, FormStateInterface $form_state) {
     parent::buildOptionsForm($form, $form_state);
 
@@ -476,6 +488,9 @@ protected function getTokenHelp() {
     return $output;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function validateOptionsForm(&$form, FormStateInterface $form_state) {
     $option_values = &$form_state->getValue('options');
     if (empty($option_values)) {
@@ -506,6 +521,9 @@ public function validateOptionsForm(&$form, FormStateInterface $form_state) {
 
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function submitOptionsForm(&$form, FormStateInterface $form_state) {
     $option_values = &$form_state->getValue('options');
     if (empty($option_values)) {
diff --git a/core/modules/views/src/Plugin/views/argument/DayDate.php b/core/modules/views/src/Plugin/views/argument/DayDate.php
index e274c5a48183..884355a72a4b 100644
--- a/core/modules/views/src/Plugin/views/argument/DayDate.php
+++ b/core/modules/views/src/Plugin/views/argument/DayDate.php
@@ -40,6 +40,9 @@ public function title() {
     return $this->dateFormatter->format(strtotime("2005" . "05" . $day . " 00:00:00 UTC"), 'custom', $this->format, 'UTC');
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function summaryArgument($data) {
     // Make sure the argument contains leading zeroes.
     return str_pad($data->{$this->base_alias}, 2, '0', STR_PAD_LEFT);
diff --git a/core/modules/views/src/Plugin/views/argument/Formula.php b/core/modules/views/src/Plugin/views/argument/Formula.php
index 3ffa4ac2b1ff..22a36129b46b 100644
--- a/core/modules/views/src/Plugin/views/argument/Formula.php
+++ b/core/modules/views/src/Plugin/views/argument/Formula.php
@@ -37,6 +37,9 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$
     }
   }
 
+  /**
+   * Gets the prepared formula.
+   */
   public function getFormula() {
     return str_replace('***table***', $this->tableAlias, $this->formula);
   }
diff --git a/core/modules/views/src/Plugin/views/argument/GroupByNumeric.php b/core/modules/views/src/Plugin/views/argument/GroupByNumeric.php
index 03b4568f33aa..2565fcd6bffd 100644
--- a/core/modules/views/src/Plugin/views/argument/GroupByNumeric.php
+++ b/core/modules/views/src/Plugin/views/argument/GroupByNumeric.php
@@ -14,6 +14,9 @@
 )]
 class GroupByNumeric extends ArgumentPluginBase {
 
+  /**
+   * {@inheritdoc}
+   */
   public function query($group_by = FALSE) {
     $this->ensureMyTable();
     $field = $this->getField();
@@ -22,6 +25,9 @@ public function query($group_by = FALSE) {
     $this->query->addHavingExpression(0, "$field = $placeholder", [$placeholder => $this->argument]);
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function adminLabel($short = FALSE) {
     return $this->getField(parent::adminLabel($short));
   }
diff --git a/core/modules/views/src/Plugin/views/argument/ManyToOne.php b/core/modules/views/src/Plugin/views/argument/ManyToOne.php
index 4b6857747b8e..552562cbbebf 100644
--- a/core/modules/views/src/Plugin/views/argument/ManyToOne.php
+++ b/core/modules/views/src/Plugin/views/argument/ManyToOne.php
@@ -46,6 +46,9 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$
     $this->value = [];
   }
 
+  /**
+   * {@inheritdoc}
+   */
   protected function defineOptions() {
     $options = parent::defineOptions();
 
@@ -65,6 +68,9 @@ protected function defineOptions() {
     return $options;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function buildOptionsForm(&$form, FormStateInterface $form_state) {
     parent::buildOptionsForm($form, $form_state);
 
@@ -102,6 +108,9 @@ public function ensureMyTable() {
     $this->helper->ensureMyTable();
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function query($group_by = FALSE) {
     $empty = FALSE;
     if (isset($this->definition['zero is null']) && $this->definition['zero is null']) {
@@ -132,6 +141,9 @@ public function query($group_by = FALSE) {
     $this->helper->addFilter();
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function title() {
     if (!$this->argument) {
       return !empty($this->definition['empty field name']) ? $this->definition['empty field name'] : $this->t('Uncategorized');
@@ -159,6 +171,9 @@ public function title() {
     return implode($this->operator == 'or' ? ' + ' : ', ', $this->titleQuery());
   }
 
+  /**
+   * {@inheritdoc}
+   */
   protected function summaryQuery() {
     $field = $this->table . '.' . $this->field;
     $join = $this->getJoin();
@@ -182,6 +197,9 @@ protected function summaryQuery() {
     return $this->summaryBasics();
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function summaryArgument($data) {
     $value = $data->{$this->base_alias};
     if (empty($value)) {
diff --git a/core/modules/views/src/Plugin/views/argument/MonthDate.php b/core/modules/views/src/Plugin/views/argument/MonthDate.php
index 81ef9985b261..cec2159c9a3d 100644
--- a/core/modules/views/src/Plugin/views/argument/MonthDate.php
+++ b/core/modules/views/src/Plugin/views/argument/MonthDate.php
@@ -48,6 +48,9 @@ public function title() {
     }
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function summaryArgument($data) {
     // Make sure the argument contains leading zeroes.
     return str_pad($data->{$this->base_alias}, 2, '0', STR_PAD_LEFT);
diff --git a/core/modules/views/src/Plugin/views/argument/NullArgument.php b/core/modules/views/src/Plugin/views/argument/NullArgument.php
index 4bfd558282f5..732caf16e610 100644
--- a/core/modules/views/src/Plugin/views/argument/NullArgument.php
+++ b/core/modules/views/src/Plugin/views/argument/NullArgument.php
@@ -15,6 +15,9 @@
 )]
 class NullArgument extends ArgumentPluginBase {
 
+  /**
+   * {@inheritdoc}
+   */
   protected function defineOptions() {
     $options = parent::defineOptions();
     $options['must_not_be'] = ['default' => FALSE];
diff --git a/core/modules/views/src/Plugin/views/argument/NumericArgument.php b/core/modules/views/src/Plugin/views/argument/NumericArgument.php
index 8d16ed8a0f3e..ac5dd39dfe0a 100644
--- a/core/modules/views/src/Plugin/views/argument/NumericArgument.php
+++ b/core/modules/views/src/Plugin/views/argument/NumericArgument.php
@@ -25,6 +25,9 @@ class NumericArgument extends ArgumentPluginBase {
    */
   public $value;
 
+  /**
+   * {@inheritdoc}
+   */
   protected function defineOptions() {
     $options = parent::defineOptions();
 
@@ -34,6 +37,9 @@ protected function defineOptions() {
     return $options;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function buildOptionsForm(&$form, FormStateInterface $form_state) {
     parent::buildOptionsForm($form, $form_state);
 
@@ -55,6 +61,9 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
     ];
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function title() {
     if (!$this->argument) {
       return !empty($this->definition['empty field name']) ? $this->definition['empty field name'] : $this->t('Uncategorized');
@@ -91,6 +100,9 @@ public function titleQuery() {
     return $this->value;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function query($group_by = FALSE) {
     $this->ensureMyTable();
 
diff --git a/core/modules/views/src/Plugin/views/argument/StringArgument.php b/core/modules/views/src/Plugin/views/argument/StringArgument.php
index 15a68e0e608d..060f8a698419 100644
--- a/core/modules/views/src/Plugin/views/argument/StringArgument.php
+++ b/core/modules/views/src/Plugin/views/argument/StringArgument.php
@@ -43,6 +43,9 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$
     }
   }
 
+  /**
+   * {@inheritdoc}
+   */
   protected function defineOptions() {
     $options = parent::defineOptions();
 
@@ -61,6 +64,9 @@ protected function defineOptions() {
     return $options;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function buildOptionsForm(&$form, FormStateInterface $form_state) {
     parent::buildOptionsForm($form, $form_state);
 
@@ -271,6 +277,9 @@ public function query($group_by = FALSE) {
     }
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function summaryArgument($data) {
     $value = $this->caseTransform($data->{$this->base_alias}, $this->options['path_case']);
     if (!empty($this->options['transform_dash'])) {
@@ -286,6 +295,9 @@ public function getSortName() {
     return $this->t('Alphabetical', [], ['context' => 'Sort order']);
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function title() {
     // Support case-insensitive title comparisons for PostgreSQL by converting
     // the title to lowercase.
@@ -324,6 +336,9 @@ public function titleQuery() {
     return $this->value;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function summaryName($data) {
     return $this->caseTransform(parent::summaryName($data), $this->options['case']);
   }
diff --git a/core/phpcs.xml.dist b/core/phpcs.xml.dist
index b3de81b4fc91..af51590c698b 100644
--- a/core/phpcs.xml.dist
+++ b/core/phpcs.xml.dist
@@ -70,6 +70,7 @@
     <exclude name="Drupal.Commenting.FunctionComment.TypeHintMissing"/>
   </rule>
   <rule ref="Drupal.Commenting.FunctionComment.Missing">
+    <include-pattern>core/modules/*/Plugin/views/argument/*</include-pattern>
     <include-pattern>core/modules/*/Plugin/views/filter/*</include-pattern>
     <include-pattern>core/modules/*/Plugin/views/access/*</include-pattern>
     <include-pattern>core/modules/*/Plugin/views/cache/*</include-pattern>
-- 
GitLab