@@ -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
@@ -80,7 +80,7 @@ You can optionally define a description, help message and the
8080:doc: `input options and arguments </console/input >`::
8181
8282 // ...
83- protected function configure()
83+ protected function configure(): void
8484 {
8585 $this
8686 // the short description shown while running "php bin/console list"
@@ -115,7 +115,7 @@ available in the ``configure()`` method::
115115 parent::__construct();
116116 }
117117
118- protected function configure()
118+ protected function configure(): void
119119 {
120120 $this
121121 // ...
@@ -151,7 +151,7 @@ The ``execute()`` method has access to the output stream to write messages to
151151the console::
152152
153153 // ...
154- protected function execute(InputInterface $input, OutputInterface $output)
154+ protected function execute(InputInterface $input, OutputInterface $output): int
155155 {
156156 // outputs multiple lines to the console (adding "\n" at the end of each line)
157157 $output->writeln([
@@ -204,7 +204,7 @@ method, which returns an instance of
204204
205205 class MyCommand extends Command
206206 {
207- protected function execute(InputInterface $input, OutputInterface $output)
207+ protected function execute(InputInterface $input, OutputInterface $output): int
208208 {
209209 if (!$output instanceof ConsoleOutputInterface) {
210210 throw new \LogicException('This command accepts only an instance of "ConsoleOutputInterface".');
@@ -251,7 +251,7 @@ Use input options or arguments to pass information to the command::
251251 use Symfony\Component\Console\Input\InputArgument;
252252
253253 // ...
254- protected function configure()
254+ protected function configure(): void
255255 {
256256 $this
257257 // configure an argument
@@ -261,7 +261,7 @@ Use input options or arguments to pass information to the command::
261261 }
262262
263263 // ...
264- public function execute(InputInterface $input, OutputInterface $output)
264+ public function execute(InputInterface $input, OutputInterface $output): int
265265 {
266266 $output->writeln([
267267 'User Creator',
@@ -315,7 +315,7 @@ as a service, you can use normal dependency injection. Imagine you have a
315315
316316 // ...
317317
318- protected function execute(InputInterface $input, OutputInterface $output)
318+ protected function execute(InputInterface $input, OutputInterface $output): int
319319 {
320320 // ...
321321
0 commit comments