Skip to content

Commit e1d519d

Browse files
committed
Better docblock array notation
1 parent cd5c376 commit e1d519d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Tools/Generator.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function generateDefinition(string $class, array $properties) : void
9090

9191
if (isset($details['$ref']))
9292
{
93-
$type = $this->getTypeNameFromRef($details['$ref']);
93+
$docType = $type = $this->getTypeNameFromRef($details['$ref']);
9494
}
9595
else
9696
{
@@ -109,7 +109,7 @@ public function generateDefinition(string $class, array $properties) : void
109109
$type = $details['format'];
110110
}
111111

112-
$type = $this->getPHPType($type);
112+
$docType = $type = $this->getPHPType($type);
113113

114114
if (isset($details['enum']))
115115
{
@@ -133,6 +133,7 @@ public function generateDefinition(string $class, array $properties) : void
133133

134134
if ('array' == $type && $itemType)
135135
{
136+
$docType = 'array<' . $itemType . '>';
136137
$type = 'array[' . $itemType . ']';
137138

138139
if ($details['maxItems'] ?? false)
@@ -164,7 +165,7 @@ public function generateDefinition(string $class, array $properties) : void
164165
$type = $originalType;
165166
}
166167
$type = \str_replace('\\\\', '\\', $type);
167-
$docBlock[] = "{$type} {$dollar}{$name} {$description}";
168+
$docBlock[] = "{$docType} {$dollar}{$name} {$description}";
168169
}
169170
}
170171
$this->generateFromTemplate($class, ['fields' => $fields, 'minLength' => $minLength, 'maxLength' => $maxLength, ], $docBlock);

0 commit comments

Comments
 (0)