@@ -153,7 +153,7 @@ public function getTypeString($schema, $path = '')
153153
154154 if ($ schema ->additionalProperties instanceof Schema) {
155155 $ typeName = $ this ->getTypeString ($ schema ->additionalProperties , $ path . '/additionalProperties ' );
156- $ or [] = "object<string, $ typeName> " ;
156+ $ or [] = "Object.<String, $ typeName> " ;
157157 $ typeAdded = true ;
158158 }
159159
@@ -168,7 +168,7 @@ public function getTypeString($schema, $path = '')
168168 }
169169
170170 if (!$ typeAdded ) {
171- $ or [] = 'object ' ;
171+ $ or [] = 'Object ' ;
172172 }
173173 }
174174
@@ -177,37 +177,37 @@ public function getTypeString($schema, $path = '')
177177
178178 if ($ schema ->items instanceof Schema) {
179179 $ typeName = $ this ->getTypeString ($ schema ->items , $ path . '/items ' );
180- $ or [] = "array <$ typeName> " ;
180+ $ or [] = "Array <$ typeName> " ;
181181 $ typeAdded = true ;
182182 }
183183
184184 if ($ schema ->additionalItems instanceof Schema) {
185185 $ typeName = $ this ->getTypeString ($ schema ->additionalItems , $ path . '/additionalItems ' );
186- $ or [] = "array <$ typeName> " ;
186+ $ or [] = "Array <$ typeName> " ;
187187 $ typeAdded = true ;
188188 }
189189
190190 if (!$ typeAdded ) {
191- $ or [] = 'array ' ;
191+ $ or [] = 'Array ' ;
192192 }
193193 }
194194
195195 if ($ isString ) {
196- $ or [] = 'string ' ;
196+ $ or [] = 'String ' ;
197197 }
198198
199199 if ($ isNumber ) {
200- $ or [] = 'number ' ;
200+ $ or [] = 'Number ' ;
201201 }
202202
203203 if ($ isBoolean ) {
204- $ or [] = 'boolean ' ;
204+ $ or [] = 'Boolean ' ;
205205 }
206206
207207 $ res = '' ;
208208 foreach ($ or as $ item ) {
209209 if (!empty ($ item ) && $ item !== '* ' ) {
210- $ res .= '| ' . $ item ;
210+ $ res .= '| ' . ( $ isOptional ? ' ? ' : '' ) . $ item ;
211211 }
212212 }
213213
@@ -256,14 +256,14 @@ private function makeObjectTypeDef(Schema $schema, $path)
256256 $ res = <<<JSDOC
257257/** $ head
258258 * @typedef {$ typeName }
259- * @type {object }
259+ * @type {Object }
260260
261261JSDOC ;
262262 if (!empty ($ schema ->properties )) {
263263 foreach ($ schema ->properties as $ propertyName => $ propertySchema ) {
264264 $ typeString = $ this ->getTypeString ($ propertySchema , $ path . '/ ' . $ propertyName );
265265 $ res .= <<<JSDOC
266- * @property { {$ typeString }} {$ propertyName }{$ this ->description ($ propertySchema )}.
266+ * @property { {$ typeString }} {$ propertyName }{$ this ->description ($ propertySchema )}
267267
268268JSDOC ;
269269
@@ -285,7 +285,7 @@ private function description(Schema $schema)
285285 {
286286 $ res = str_replace ("\n" , " " , $ schema ->title . $ schema ->description );
287287 if ($ res ) {
288- return ' - ' . rtrim ($ res , '. ' );
288+ return ' - ' . rtrim ($ res , '. ' ) . ' . ' ;
289289 }
290290
291291 return '' ;
0 commit comments