thrownewLogicException(\sprintf('An argument with name "%s" already exists.',$argument->getName()));
}
if(null!==$this->lastArrayArgument){
thrownewLogicException(\sprintf('Cannot add a required argument "%s" after an array argument "%s".',$argument->getName(),$this->lastArrayArgument->getName()));
thrownewLogicException(\sprintf('Cannot add a required argument "%s" after an optional one "%s".',$argument->getName(),$this->lastOptionalArgument->getName()));
}
if($argument->isArray()){
$this->lastArrayArgument=$argument;
}
if($argument->isRequired()){
++$this->requiredCount;
}else{
$this->lastOptionalArgument=$argument;
}
$this->arguments[$argument->getName()]=$argument;
}
/**
* Returns an InputArgument by name or by position.
*
* @throws InvalidArgumentException When argument given doesn't exist