From 8f9d1ddba9f8f5b8a28be72acfa0998c0fe1844d Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Sun, 29 Oct 2023 14:26:44 +0100 Subject: [PATCH] Extract a strongly typed helper method --- .../framework/src/Console/Commands/MakePageCommand.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/framework/src/Console/Commands/MakePageCommand.php b/packages/framework/src/Console/Commands/MakePageCommand.php index bbcc621097e..d5edac94a07 100644 --- a/packages/framework/src/Console/Commands/MakePageCommand.php +++ b/packages/framework/src/Console/Commands/MakePageCommand.php @@ -80,7 +80,7 @@ protected function validateOptions(): void protected function getTitle(): string { return $this->argument('title') - ?? $this->ask('What is the title of the page?') + ?? $this->askForString('What is the title of the page?') ?? 'My New Page'; } @@ -116,4 +116,9 @@ protected function getTypeOption(): ?string return null; } + + protected function askForString(string $question, ?string $default = null): ?string + { + return $this->ask($question, $default); + } }