From 4337ddf58d28dbdee4e1367bf71ee13393ab9820 Mon Sep 17 00:00:00 2001
From: Klaus Purer <klaus.purer@protonmail.ch>
Date: Fri, 9 Aug 2019 11:27:26 +0200
Subject: [PATCH] fix(DocCommentAlignment): Allow @see references to be
 indented under @param docs (#3073750)

---
 .../Sniffs/Commenting/DocCommentAlignmentSniff.php    |  3 ++-
 .../Drupal/Sniffs/Commenting/DocCommentSniff.php      |  1 +
 .../Test/Commenting/DocCommentAlignmentUnitTest.inc   | 11 +++++++++++
 .../Commenting/DocCommentAlignmentUnitTest.inc.fixed  | 11 +++++++++++
 4 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/coder_sniffer/Drupal/Sniffs/Commenting/DocCommentAlignmentSniff.php b/coder_sniffer/Drupal/Sniffs/Commenting/DocCommentAlignmentSniff.php
index a2ddaf8d..c6ccc6e4 100644
--- a/coder_sniffer/Drupal/Sniffs/Commenting/DocCommentAlignmentSniff.php
+++ b/coder_sniffer/Drupal/Sniffs/Commenting/DocCommentAlignmentSniff.php
@@ -137,9 +137,10 @@ class DocCommentAlignmentSniff implements Sniff
                 }
             } else if ($tokens[($i + 2)]['code'] === T_DOC_COMMENT_TAG
                 && $tokens[($i + 1)]['content'] !== ' '
-                // Special @code/@endcode tags can have more than 1 space.
+                // Special @code/@endcode/@see tags can have more than 1 space.
                 && $tokens[($i + 2)]['content'] !== '@code'
                 && $tokens[($i + 2)]['content'] !== '@endcode'
+                && $tokens[($i + 2)]['content'] !== '@see'
             ) {
                 $error = 'Expected 1 space after asterisk; %s found';
                 $data  = [strlen($tokens[($i + 1)]['content'])];
diff --git a/coder_sniffer/Drupal/Sniffs/Commenting/DocCommentSniff.php b/coder_sniffer/Drupal/Sniffs/Commenting/DocCommentSniff.php
index c0c572df..4e96145c 100644
--- a/coder_sniffer/Drupal/Sniffs/Commenting/DocCommentSniff.php
+++ b/coder_sniffer/Drupal/Sniffs/Commenting/DocCommentSniff.php
@@ -378,6 +378,7 @@ class DocCommentSniff implements Sniff
         $ignoreTags   = [
             '@code',
             '@endcode',
+            '@see',
         ];
         foreach ($tokens[$commentStart]['comment_tags'] as $pos => $tag) {
             if ($pos > 0) {
diff --git a/coder_sniffer/Drupal/Test/Commenting/DocCommentAlignmentUnitTest.inc b/coder_sniffer/Drupal/Test/Commenting/DocCommentAlignmentUnitTest.inc
index 2b2c2e67..77935321 100644
--- a/coder_sniffer/Drupal/Test/Commenting/DocCommentAlignmentUnitTest.inc
+++ b/coder_sniffer/Drupal/Test/Commenting/DocCommentAlignmentUnitTest.inc
@@ -16,3 +16,14 @@ class Test {
   var $varStyle;
 
 }
+
+/**
+ * Short description.
+ *
+ * @param string $a
+ *   The following reference is allowed to be indented.
+ *   @see my_function()
+ */
+function test31($a) {
+
+}
diff --git a/coder_sniffer/Drupal/Test/Commenting/DocCommentAlignmentUnitTest.inc.fixed b/coder_sniffer/Drupal/Test/Commenting/DocCommentAlignmentUnitTest.inc.fixed
index 5cce8f7f..36140ef6 100644
--- a/coder_sniffer/Drupal/Test/Commenting/DocCommentAlignmentUnitTest.inc.fixed
+++ b/coder_sniffer/Drupal/Test/Commenting/DocCommentAlignmentUnitTest.inc.fixed
@@ -16,3 +16,14 @@ class Test {
   public $varStyle;
 
 }
+
+/**
+ * Short description.
+ *
+ * @param string $a
+ *   The following reference is allowed to be indented.
+ *   @see my_function()
+ */
+function test31($a) {
+
+}
-- 
GitLab