Skip to content

Commit 592910d

Browse files
committed
preserve alt array syntax
1 parent 32a7e6a commit 592910d

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

dev/src/DocFx/Node/ParameterNode.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,16 +129,13 @@ private function resolveNestedType(string $name): string
129129
));
130130
}
131131

132-
$normalized = '[]' === substr($name, -2)
133-
? sprintf('array<%s>', substr($name, 0, -2))
134-
: $name;
135-
136-
if (0 === strpos($normalized, 'array<')) {
132+
$altarray = '[]' === substr($name, -2);
133+
if ($altarray || 0 === strpos($name, 'array<')) {
137134
return preg_replace_callback(
138135
'/^array<([^ ]*)>$/',
139-
function ($matches) use ($name) {
140-
$resolved = $this->resolveNestedType($matches[1]);
141-
return ($resolved === $matches[1]) ? $name : sprintf('array<%s>', $resolved);
136+
function ($matches) use ($altarray) {
137+
$type = $this->resolveNestedType($matches[1]);
138+
return $altarray ? $type . '[]' : sprintf('array<%s>', $type);
142139
},
143140
$name
144141
);

0 commit comments

Comments
 (0)