@@ -38,12 +38,12 @@ want a command to create a user::
3838 // the name of the command (the part after "bin/console")
3939 protected static $defaultName = 'app:create-user';
4040
41- protected function configure()
41+ protected function configure(): void
4242 {
4343 // ...
4444 }
4545
46- protected function execute(InputInterface $input, OutputInterface $output)
46+ protected function execute(InputInterface $input, OutputInterface $output): int
4747 {
4848 // ... put here the code to create the user
4949
@@ -65,7 +65,7 @@ You can optionally define a description, help message and the
6565:doc: `input options and arguments </console/input >`::
6666
6767 // ...
68- protected function configure()
68+ protected function configure(): void
6969 {
7070 $this
7171 // the short description shown while running "php bin/console list"
@@ -100,7 +100,7 @@ available in the ``configure()`` method::
100100 parent::__construct();
101101 }
102102
103- protected function configure()
103+ protected function configure(): void
104104 {
105105 $this
106106 // ...
@@ -136,7 +136,7 @@ The ``execute()`` method has access to the output stream to write messages to
136136the console::
137137
138138 // ...
139- protected function execute(InputInterface $input, OutputInterface $output)
139+ protected function execute(InputInterface $input, OutputInterface $output): int
140140 {
141141 // outputs multiple lines to the console (adding "\n" at the end of each line)
142142 $output->writeln([
@@ -189,7 +189,7 @@ method, which returns an instance of
189189
190190 class MyCommand extends Command
191191 {
192- protected function execute(InputInterface $input, OutputInterface $output)
192+ protected function execute(InputInterface $input, OutputInterface $output): int
193193 {
194194 if (!$output instanceof ConsoleOutputInterface) {
195195 throw new \LogicException('This command accepts only an instance of "ConsoleOutputInterface".');
@@ -236,7 +236,7 @@ Use input options or arguments to pass information to the command::
236236 use Symfony\Component\Console\Input\InputArgument;
237237
238238 // ...
239- protected function configure()
239+ protected function configure(): void
240240 {
241241 $this
242242 // configure an argument
@@ -246,7 +246,7 @@ Use input options or arguments to pass information to the command::
246246 }
247247
248248 // ...
249- public function execute(InputInterface $input, OutputInterface $output)
249+ public function execute(InputInterface $input, OutputInterface $output): int
250250 {
251251 $output->writeln([
252252 'User Creator',
@@ -300,7 +300,7 @@ as a service, you can use normal dependency injection. Imagine you have a
300300
301301 // ...
302302
303- protected function execute(InputInterface $input, OutputInterface $output)
303+ protected function execute(InputInterface $input, OutputInterface $output): int
304304 {
305305 // ...
306306
0 commit comments