Skip to content

Commit

Permalink
Fix confirm component
Browse files Browse the repository at this point in the history
  • Loading branch information
brendt committed Apr 15, 2024
1 parent 44d5b79 commit 4e6a74b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/Exceptions/CommandNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function render(Console $console): void
options: $similarCommands,
);

throw MistypedCommandException::for($intendedCommand);
throw new MistypedCommandException($intendedCommand);
}

private function getSimilarCommands(): array
Expand Down
5 changes: 0 additions & 5 deletions src/Exceptions/MistypedCommandException.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,4 @@ public function __construct(
public readonly string $intendedCommand,
) {
}

public static function for(string $intendedCommand): MistypedCommandException
{
return new self($intendedCommand);
}
}
7 changes: 1 addition & 6 deletions src/GenericConsole.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,7 @@ public function ask(string $question, ?array $options = null): string

public function confirm(string $question, bool $default = false): bool
{
$result = $this->component(new ConfirmComponent($question));

return match ($result) {
'yes' => true,
default => false,
};
return $this->component(new ConfirmComponent($question));
}

public function password(string $label = 'Password', bool $confirm = false): string
Expand Down

0 comments on commit 4e6a74b

Please sign in to comment.