@@ -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
@@ -72,7 +72,7 @@ You can optionally define a description, help message and the
7272:doc: `input options and arguments </console/input >`::
7373
7474 // ...
75- protected function configure()
75+ protected function configure(): void
7676 {
7777 $this
7878 // the short description shown while running "php bin/console list"
@@ -107,7 +107,7 @@ available in the ``configure()`` method::
107107 parent::__construct();
108108 }
109109
110- protected function configure()
110+ protected function configure(): void
111111 {
112112 $this
113113 // ...
@@ -143,7 +143,7 @@ The ``execute()`` method has access to the output stream to write messages to
143143the console::
144144
145145 // ...
146- protected function execute(InputInterface $input, OutputInterface $output)
146+ protected function execute(InputInterface $input, OutputInterface $output): int
147147 {
148148 // outputs multiple lines to the console (adding "\n" at the end of each line)
149149 $output->writeln([
@@ -196,7 +196,7 @@ method, which returns an instance of
196196
197197 class MyCommand extends Command
198198 {
199- protected function execute(InputInterface $input, OutputInterface $output)
199+ protected function execute(InputInterface $input, OutputInterface $output): int
200200 {
201201 if (!$output instanceof ConsoleOutputInterface) {
202202 throw new \LogicException('This command accepts only an instance of "ConsoleOutputInterface".');
@@ -243,7 +243,7 @@ Use input options or arguments to pass information to the command::
243243 use Symfony\Component\Console\Input\InputArgument;
244244
245245 // ...
246- protected function configure()
246+ protected function configure(): void
247247 {
248248 $this
249249 // configure an argument
@@ -253,7 +253,7 @@ Use input options or arguments to pass information to the command::
253253 }
254254
255255 // ...
256- public function execute(InputInterface $input, OutputInterface $output)
256+ public function execute(InputInterface $input, OutputInterface $output): int
257257 {
258258 $output->writeln([
259259 'User Creator',
@@ -307,7 +307,7 @@ as a service, you can use normal dependency injection. Imagine you have a
307307
308308 // ...
309309
310- protected function execute(InputInterface $input, OutputInterface $output)
310+ protected function execute(InputInterface $input, OutputInterface $output): int
311311 {
312312 // ...
313313
0 commit comments