Repository: FriendsOfPHP/PHP-CS-Fixer (php)

Issue:
`single_space_after_construct` adds extra space after comment
## Bug report

### Code snippet that reproduces the problem

```diff
    1) data/src/Persistence/Sql/Query.php (single_space_after_construct)
      ---------- begin diff ----------
--- /__w/data/data/src/Persistence/Sql/Query.php
+++ /__w/data/data/src/Persistence/Sql/Query.php
@@ -816,7 +816,7 @@
         $ret = [];
 
         if ($this->args['set']) {
-            foreach ($this->args['set'] as [$field/*, $value*/]) {
+            foreach ($this->args['set'] as [$field/*, $value*/ ]) {
                 $field = $this->consume($field, self::ESCAPE_IDENTIFIER);
 
                 $ret[] = $field;

      ----------- end diff -----------
```

no space should be added around comments as this complicates debugging and it the case above it is even wrong

Pull request description:
SingleSpaceAfterConstruct - handle before destructuring close brace
Fixer 'single_space_after_construct' should not insert whitespace after those comments that before destructuring square brace close tag

closes #6110 



Patch:
diff --git a/src/Fixer/LanguageConstruct/SingleSpaceAfterConstructFixer.php b/src/Fixer/LanguageConstruct/SingleSpaceAfterConstructFixer.php
index f9ab014d7..cf2518aa2 100644
--- a/src/Fixer/LanguageConstruct/SingleSpaceAfterConstructFixer.php
+++ b/src/Fixer/LanguageConstruct/SingleSpaceAfterConstructFixer.php
@@ -219,7 +219,7 @@ protected function applyFix(\SplFileInfo $file, Tokens $tokens): void
 
             $whitespaceTokenIndex = $index + 1;
 
-            if ($tokens[$whitespaceTokenIndex]->equalsAny([',', ';', ')', [CT::T_ARRAY_SQUARE_BRACE_CLOSE]])) {
+            if ($tokens[$whitespaceTokenIndex]->equalsAny([',', ';', ')', [CT::T_ARRAY_SQUARE_BRACE_CLOSE], [CT::T_DESTRUCTURING_SQUARE_BRACE_CLOSE]])) {
                 continue;
             }
 


Test patch:
diff --git a/tests/Fixer/LanguageConstruct/SingleSpaceAfterConstructFixerTest.php b/tests/Fixer/LanguageConstruct/SingleSpaceAfterConstructFixerTest.php
index eef27434f..20b6df2fc 100644
--- a/tests/Fixer/LanguageConstruct/SingleSpaceAfterConstructFixerTest.php
+++ b/tests/Fixer/LanguageConstruct/SingleSpaceAfterConstructFixerTest.php
@@ -2923,6 +2923,13 @@ public function provideCommentsCases(): \Generator
 foo(/* c */);
 foo($a /* d */, $b);
 $arr = [/* empty */];
+',
+        ];
+
+        yield 'before_destructuring_square_brace_close' => [
+            '<?php
+foreach ($fields as [$field/** @var string*/]) {
+}
 ',
         ];
     }