@@ -367,6 +367,34 @@ public function testUpdateMethodParametersFromTags(): void
367
367
);
368
368
}
369
369
370
+ /**
371
+ * @see NodeVisitor::updateMethodParametersFromTags
372
+ * @see https://github.com/20Tauri/DoxyDoxygen/issues/135#issuecomment-512090231
373
+ */
374
+ public function testUpdateMethodParametersFromTagsVariadic (): void
375
+ {
376
+ $ docBlockParser = new DocBlockParser ();
377
+ $ docBlockNode = $ docBlockParser ->parse (
378
+ '/** ' . "\n"
379
+ . '* @param FooBar|baz|string ...$args ' . "\n"
380
+ . '**/ ' . "\n"
381
+ );
382
+ $ parserContext = new ParserContext (new TrueFilter (), new DocBlockParser (), new Standard ());
383
+ $ visitor = new NodeVisitor ($ parserContext );
384
+ $ function = new FunctionReflection ('fun1 ' , 0 );
385
+
386
+ $ param1 = (new ParameterReflection ('args ' , 0 ));
387
+ $ function ->addParameter ($ param1 );
388
+
389
+ $ this ->assertSame (
390
+ [],
391
+ $ this ->callMethod ($ visitor , 'updateMethodParametersFromTags ' , [
392
+ $ function ,
393
+ $ docBlockNode ->getTag ('param ' )
394
+ ])
395
+ );
396
+ }
397
+
370
398
/**
371
399
* @see NodeVisitor::updateMethodParametersFromTags
372
400
* @requires PHP 7.2
@@ -471,4 +499,32 @@ public function testAddTagFromCommentToMethodInvalidHint(): void
471
499
$ errors
472
500
);
473
501
}
502
+
503
+ /**
504
+ * @see NodeVisitor::addTagFromCommentToMethod
505
+ */
506
+ public function testAddTagFromCommentToMethodHintVariadic (): void
507
+ {
508
+ $ docBlockParser = new DocBlockParser ();
509
+ $ docBlockNode = $ docBlockParser ->parse (
510
+ '/** ' . "\n"
511
+ . '* @var FooBar|baz|string ...$args ' . "\n"
512
+ . '**/ ' . "\n"
513
+ );
514
+ $ parserContext = new ParserContext (new TrueFilter (), new DocBlockParser (), new Standard ());
515
+ $ visitor = new NodeVisitor ($ parserContext );
516
+ $ property = new PropertyReflection ('args ' , 0 );
517
+
518
+ $ errors = [];
519
+ $ this ->callMethod ($ visitor , 'addTagFromCommentToMethod ' , [
520
+ 'var ' ,
521
+ $ docBlockNode ,
522
+ $ property ,
523
+ &$ errors
524
+ ]);
525
+ $ this ->assertSame (
526
+ [],
527
+ $ errors
528
+ );
529
+ }
474
530
}
0 commit comments