/**
  * @covers phpDocumentor\Descriptor\MethodDescriptor::setArguments
  * @covers phpDocumentor\Descriptor\MethodDescriptor::getArguments
  */
 public function testSettingAndGettingArguments()
 {
     $this->assertInstanceOf('phpDocumentor\\Descriptor\\Collection', $this->fixture->getArguments());
     $mock = m::mock('phpDocumentor\\Descriptor\\Collection');
     $this->fixture->setArguments($mock);
     $this->assertSame($mock, $this->fixture->getArguments());
 }
 /**
  * Checks if there is a variadic argument in the `@param` tags and adds it to the list of Arguments in
  * the Descriptor unless there is already one present.
  *
  * @param MethodReflector  $data
  * @param MethodDescriptor $methodDescriptor
  *
  * @return void
  */
 protected function addVariadicArgument($data, $methodDescriptor)
 {
     if (!$data->getDocBlock()) {
         return;
     }
     $paramTags = $data->getDocBlock()->getTagsByName('param');
     /** @var ParamTag $lastParamTag */
     $lastParamTag = end($paramTags);
     if (!$lastParamTag) {
         return;
     }
     if ($lastParamTag->isVariadic() && !in_array($lastParamTag->getVariableName(), array_keys($methodDescriptor->getArguments()->getAll()))) {
         $types = $this->builder->buildDescriptor(new Collection($lastParamTag->getTypes()));
         $argument = new ArgumentDescriptor();
         $argument->setName($lastParamTag->getVariableName());
         $argument->setTypes($types);
         $argument->setDescription($lastParamTag->getDescription());
         $argument->setLine($methodDescriptor->getLine());
         $argument->setVariadic(true);
         $methodDescriptor->getArguments()->set($argument->getName(), $argument);
     }
 }