From 2f40924701d724c569b20d95af980a097bc82a76 Mon Sep 17 00:00:00 2001 From: Marian <42134098+IanDelMar@users.noreply.github.com> Date: Fri, 23 Jan 2026 21:31:24 +0100 Subject: [PATCH] Improve regex to also match Type[][] --- src/Visitor.php | 2 +- wordpress-stubs.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Visitor.php b/src/Visitor.php index f8d18396..a85e8b46 100644 --- a/src/Visitor.php +++ b/src/Visitor.php @@ -676,7 +676,7 @@ private static function getTypeNameFromString(string $tagVariable): ?string { // PHPStan doesn't support typed array shapes (`int[]{...}`) so replace // typed arrays such as `int[]` with `array`. - $tagVariableType = preg_replace('#[a-zA-Z0-9_]+\[\]#', 'array', $tagVariable); + $tagVariableType = preg_replace('#[a-zA-Z0-9_]+(?:\[\])+#', 'array', $tagVariable); if ($tagVariableType === null) { return null; diff --git a/wordpress-stubs.php b/wordpress-stubs.php index c71fca87..ee9fee44 100644 --- a/wordpress-stubs.php +++ b/wordpress-stubs.php @@ -66299,7 +66299,7 @@ public function __construct() * @param array[][] $fonts Optional. The font-families and their font variations. * See {@see wp_print_font_faces()} for the supported fields. * Default empty array. - * @phpstan-param array[]