Browse Source

Fix PHPDoc line span fixer when property has array typehint

Gocha Ossinkine 4 years ago
parent
commit
19013609ce

+ 1 - 0
src/Fixer/Phpdoc/PhpdocLineSpanFixer.php

@@ -144,6 +144,7 @@ final class PhpdocLineSpanFixer extends AbstractFixer implements WhitespacesAwar
             T_STATIC,
             T_STATIC,
             T_STRING,
             T_STRING,
             T_NS_SEPARATOR,
             T_NS_SEPARATOR,
+            CT::T_ARRAY_TYPEHINT,
             CT::T_NULLABLE_TYPE,
             CT::T_NULLABLE_TYPE,
         ]));
         ]));
 
 

+ 21 - 0
tests/Fixer/Phpdoc/PhpdocLineSpanFixerTest.php

@@ -506,6 +506,27 @@ class Foo
      *
      *
      */
      */
     private ?string $foo;
     private ?string $foo;
+}',
+                [
+                    'property' => 'single',
+                ],
+            ],
+            'It can handle properties with array type declaration' => [
+                '<?php
+
+class Foo
+{
+    /** @var string[] */
+    private array $foo;
+}',
+                '<?php
+
+class Foo
+{
+    /**
+     * @var string[]
+     */
+    private array $foo;
 }',
 }',
                 [
                 [
                     'property' => 'single',
                     'property' => 'single',