Browse Source

PhpdocTypesFixer - fix for multidimensional array

Kuba Werłos 4 years ago
parent
commit
6311fc4077
2 changed files with 19 additions and 1 deletions
  1. 1 1
      src/AbstractPhpdocTypesFixer.php
  2. 18 0
      tests/Fixer/Phpdoc/PhpdocTypesFixerTest.php

+ 1 - 1
src/AbstractPhpdocTypesFixer.php

@@ -127,7 +127,7 @@ abstract class AbstractPhpdocTypesFixer extends AbstractFixer
     private function normalizeType($type)
     {
         if ('[]' === substr($type, -2)) {
-            return $this->normalize(substr($type, 0, -2)).'[]';
+            return $this->normalizeType(substr($type, 0, -2)).'[]';
         }
 
         return $this->normalize($type);

+ 18 - 0
tests/Fixer/Phpdoc/PhpdocTypesFixerTest.php

@@ -73,6 +73,24 @@ EOF;
         $this->doTest($expected, $input);
     }
 
+    public function testNestedArrayStuff()
+    {
+        $expected = <<<'EOF'
+<?php
+    /**
+     * @return int[][][]
+     */
+EOF;
+
+        $input = <<<'EOF'
+<?php
+    /**
+     * @return INT[][][]
+     */
+EOF;
+        $this->doTest($expected, $input);
+    }
+
     public function testMixedAndVoid()
     {
         $expected = <<<'EOF'