11
0
Fork 0
mirror of https://github.com/n3w/helpers-cli-input.git synced 2025-12-19 12:43:23 +00:00

Updated RequiredInputMissingException and RequiredInputMissingValueException exceptions to use getDisplayName() when producing their message

This commit is contained in:
Alannah Kearney 2019-05-25 11:58:33 +10:00
commit c5aa26b19d
2 changed files with 5 additions and 8 deletions

View file

@ -15,10 +15,8 @@ class RequiredInputMissingException extends \Exception
$this->input = $input; $this->input = $input;
return parent::__construct(sprintf( return parent::__construct(sprintf(
'missing %s %s%s', 'missing %s',
$input->getType(), $input->getDisplayName()
'option' == $input->getType() ? '-' : '',
'option' == $input->getType() ? $input->name() : strtoupper($input->name())
), $code, $previous); ), $code, $previous);
} }

View file

@ -15,11 +15,10 @@ class RequiredInputMissingValueException extends \Exception
$this->input = $input; $this->input = $input;
return parent::__construct(sprintf( return parent::__construct(sprintf(
'%s %s%s is missing a value', 'a value is required for %s',
$input->getType(), $input->getDisplayName()
'option' == $input->getType() ? '-' : '',
'option' == $input->getType() ? $input->name() : strtoupper($input->name())
), $code, $previous); ), $code, $previous);
} }
public function getInput(): Input\AbstractInputType public function getInput(): Input\AbstractInputType