Fork me on GitHub
a Sensio Labs Product

15 Keys Accelerate (v3.54.0) 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.