@@ -338,7 +338,7 @@ public function testRegressionWordpressDocblocks(): void
338338 false ,
339339 new Description (
340340 '{ ' . "\n" .
341- 'Optional. Array or string of arguments for installing a package. Default empty array. ' . "\n" .
341+ ' Optional. Array or string of arguments for installing a package. Default empty array. ' . "\n" .
342342 "\n" .
343343 ' @type string $source Required path to the package source. Default empty. ' . "\n" .
344344 ' @type string $destination Required path to a folder to install the package in. ' . "\n" .
@@ -364,4 +364,71 @@ public function testRegressionWordpressDocblocks(): void
364364 $ docblock
365365 );
366366 }
367+
368+ public function testIndentationIsKept (): void
369+ {
370+ $ docComment = <<<DOC
371+ /**
372+ * Registers the script module if no script module with that script module
373+ * identifier has already been registered.
374+ *
375+ * @since 6.5.0
376+ *
377+ * @param array \$deps {
378+ * Optional. List of dependencies.
379+ *
380+ * @type string|array ...$0 {
381+ * An array of script module identifiers of the dependencies of this script
382+ * module. The dependencies can be strings or arrays. If they are arrays,
383+ * they need an `id` key with the script module identifier, and can contain
384+ * an `import` key with either `static` or `dynamic`. By default,
385+ * dependencies that don't contain an `import` key are considered static.
386+ *
387+ * @type string \$id The script module identifier.
388+ * @type string \$import Optional. Import type. May be either `static` or
389+ * `dynamic`. Defaults to `static`.
390+ * }
391+ * }
392+ */
393+ DOC ;
394+
395+ $ factory = DocBlockFactory::createInstance ();
396+ $ docblock = $ factory ->create ($ docComment );
397+
398+ self ::assertEquals (
399+ new DocBlock (
400+ 'Registers the script module if no script module with that script module
401+ identifier has already been registered. ' ,
402+ new Description (
403+ ''
404+ ),
405+ [
406+ new Since ('6.5.0 ' , new Description ('' )),
407+ new Param (
408+ 'deps ' ,
409+ new Array_ (new Mixed_ ()),
410+ false ,
411+ new Description ("{
412+ Optional. List of dependencies.
413+
414+ @type string|array ...$0 {
415+ An array of script module identifiers of the dependencies of this script
416+ module. The dependencies can be strings or arrays. If they are arrays,
417+ they need an `id` key with the script module identifier, and can contain
418+ an `import` key with either `static` or `dynamic`. By default,
419+ dependencies that don't contain an `import` key are considered static.
420+
421+ @type string \$id The script module identifier.
422+ @type string \$import Optional. Import type. May be either `static` or
423+ `dynamic`. Defaults to `static`.
424+ }
425+ } "
426+ )
427+ ),
428+ ],
429+ new Context ('\\' )
430+ ),
431+ $ docblock
432+ );
433+ }
367434}
0 commit comments