Skip to content

Commit

Permalink
Remove truthy check on required
Browse files Browse the repository at this point in the history
  • Loading branch information
jessarcher committed Oct 27, 2023
1 parent efe657e commit 2227716
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Prompt.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,9 @@ private function validate(mixed $value): void
{
$this->validated = true;

if (($this->required ?? false) && $this->isInvalidWhenRequired($value)) {
if ($this->required !== false && $this->isInvalidWhenRequired($value)) {
$this->state = 'error';
$this->error = is_string($this->required) ? $this->required : 'Required.';
$this->error = is_string($this->required) && strlen($this->required) > 0 ? $this->required : 'Required.';

return;
}
Expand Down

0 comments on commit 2227716

Please sign in to comment.