Fork me on GitHub
a Sensio Labs Product

7th Gear (v3.59.3) edition

Rule phpdoc_array_type

PHPDoc array<T> type must be used instead of T[].

Warning

Using this rule is risky

Risky when using T[] in union types.

Examples

Example #1

--- Original
+++ New
 <?php
 /**
- * @param int[] $x
- * @param string[][] $y
+ * @param array<int> $x
+ * @param array<array<string>> $y
  */

References

The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.