From 4b8114db9fc724eb38c70c15b4db1edf0712f4a9 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Fri, 29 Mar 2019 15:30:10 +0100 Subject: [PATCH] be consistent with ask() example --- console/style.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/console/style.rst b/console/style.rst index 86192b70870..ed9cacbce63 100644 --- a/console/style.rst +++ b/console/style.rst @@ -248,7 +248,9 @@ User Input Methods $io->askHidden('What is your password?'); - // validates the given answer + In case you need to validate the given value, pass a callback validator as + the second argument:: + $io->askHidden('What is your password?', function ($password) { if (empty($password)) { throw new \RuntimeException('Password cannot be empty.'); @@ -352,6 +354,7 @@ Then, instantiate this custom class instead of the default ``SymfonyStyle`` in your commands. Thanks to the ``StyleInterface`` you won't need to change the code of your commands to change their appearance:: + // src/AppBundle/Command/GreetCommand.php namespace AppBundle\Console; use AppBundle\Console\CustomStyle;