Skip to content

Commit 8498d5b

Browse files
wouterjnicolas-grekas
authored andcommitted
Add void return types
1 parent f9f6e66 commit 8498d5b

File tree

68 files changed

+398
-113
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+398
-113
lines changed

Application.php

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,14 @@ public function __construct(string $name = 'UNKNOWN', string $version = 'UNKNOWN
105105
/**
106106
* @final
107107
*/
108-
public function setDispatcher(EventDispatcherInterface $dispatcher)
108+
public function setDispatcher(EventDispatcherInterface $dispatcher): void
109109
{
110110
$this->dispatcher = $dispatcher;
111111
}
112112

113+
/**
114+
* @return void
115+
*/
113116
public function setCommandLoader(CommandLoaderInterface $commandLoader)
114117
{
115118
$this->commandLoader = $commandLoader;
@@ -124,6 +127,9 @@ public function getSignalRegistry(): SignalRegistry
124127
return $this->signalRegistry;
125128
}
126129

130+
/**
131+
* @return void
132+
*/
127133
public function setSignalsToDispatchEvent(int ...$signalsToDispatchEvent)
128134
{
129135
$this->signalsToDispatchEvent = $signalsToDispatchEvent;
@@ -317,10 +323,16 @@ public function doRun(InputInterface $input, OutputInterface $output)
317323
return $exitCode;
318324
}
319325

326+
/**
327+
* @return void
328+
*/
320329
public function reset()
321330
{
322331
}
323332

333+
/**
334+
* @return void
335+
*/
324336
public function setHelperSet(HelperSet $helperSet)
325337
{
326338
$this->helperSet = $helperSet;
@@ -334,6 +346,9 @@ public function getHelperSet(): HelperSet
334346
return $this->helperSet ??= $this->getDefaultHelperSet();
335347
}
336348

349+
/**
350+
* @return void
351+
*/
337352
public function setDefinition(InputDefinition $definition)
338353
{
339354
$this->definition = $definition;
@@ -404,6 +419,8 @@ public function areExceptionsCaught(): bool
404419

405420
/**
406421
* Sets whether to catch exceptions or not during commands execution.
422+
*
423+
* @return void
407424
*/
408425
public function setCatchExceptions(bool $boolean)
409426
{
@@ -420,6 +437,8 @@ public function isAutoExitEnabled(): bool
420437

421438
/**
422439
* Sets whether to automatically exit after a command execution or not.
440+
*
441+
* @return void
423442
*/
424443
public function setAutoExit(bool $boolean)
425444
{
@@ -436,7 +455,9 @@ public function getName(): string
436455

437456
/**
438457
* Sets the application name.
439-
**/
458+
*
459+
* @return void
460+
*/
440461
public function setName(string $name)
441462
{
442463
$this->name = $name;
@@ -452,6 +473,8 @@ public function getVersion(): string
452473

453474
/**
454475
* Sets the application version.
476+
*
477+
* @return void
455478
*/
456479
public function setVersion(string $version)
457480
{
@@ -490,6 +513,8 @@ public function register(string $name): Command
490513
* If a Command is not enabled it will not be added.
491514
*
492515
* @param Command[] $commands An array of commands
516+
*
517+
* @return void
493518
*/
494519
public function addCommands(array $commands)
495520
{
@@ -899,6 +924,8 @@ protected function doRenderThrowable(\Throwable $e, OutputInterface $output): vo
899924

900925
/**
901926
* Configures the input and output instances based on the user arguments and options.
927+
*
928+
* @return void
902929
*/
903930
protected function configureIO(InputInterface $input, OutputInterface $output)
904931
{
@@ -1250,7 +1277,7 @@ private function extractAllNamespaces(string $name): array
12501277
return $namespaces;
12511278
}
12521279

1253-
private function init()
1280+
private function init(): void
12541281
{
12551282
if ($this->initialized) {
12561283
return;

Command/Command.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,17 @@ public function __construct(string $name = null)
141141
* Ignores validation errors.
142142
*
143143
* This is mainly useful for the help command.
144+
*
145+
* @return void
144146
*/
145147
public function ignoreValidationErrors()
146148
{
147149
$this->ignoreValidationErrors = true;
148150
}
149151

152+
/**
153+
* @return void
154+
*/
150155
public function setApplication(Application $application = null)
151156
{
152157
if (1 > \func_num_args()) {
@@ -162,6 +167,9 @@ public function setApplication(Application $application = null)
162167
$this->fullDefinition = null;
163168
}
164169

170+
/**
171+
* @return void
172+
*/
165173
public function setHelperSet(HelperSet $helperSet)
166174
{
167175
$this->helperSet = $helperSet;
@@ -198,6 +206,8 @@ public function isEnabled()
198206

199207
/**
200208
* Configures the current command.
209+
*
210+
* @return void
201211
*/
202212
protected function configure()
203213
{
@@ -228,6 +238,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
228238
* This method is executed before the InputDefinition is validated.
229239
* This means that this is the only place where the command can
230240
* interactively ask for values of missing required arguments.
241+
*
242+
* @return void
231243
*/
232244
protected function interact(InputInterface $input, OutputInterface $output)
233245
{
@@ -242,6 +254,8 @@ protected function interact(InputInterface $input, OutputInterface $output)
242254
*
243255
* @see InputInterface::bind()
244256
* @see InputInterface::validate()
257+
*
258+
* @return void
245259
*/
246260
protected function initialize(InputInterface $input, OutputInterface $output)
247261
{
@@ -378,7 +392,7 @@ public function setCode(callable $code): static
378392
*
379393
* @internal
380394
*/
381-
public function mergeApplicationDefinition(bool $mergeArgs = true)
395+
public function mergeApplicationDefinition(bool $mergeArgs = true): void
382396
{
383397
if (null === $this->application) {
384398
return;
@@ -702,7 +716,7 @@ public function getHelper(string $name): mixed
702716
*
703717
* @throws InvalidArgumentException When the name is invalid
704718
*/
705-
private function validateName(string $name)
719+
private function validateName(string $name): void
706720
{
707721
if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) {
708722
throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));

Command/CompleteCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ protected function configure(): void
7474
;
7575
}
7676

77-
protected function initialize(InputInterface $input, OutputInterface $output)
77+
protected function initialize(InputInterface $input, OutputInterface $output): void
7878
{
7979
$this->isDebug = filter_var(getenv('SYMFONY_COMPLETION_DEBUG'), \FILTER_VALIDATE_BOOL);
8080
}

Command/DumpCompletionCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ final class DumpCompletionCommand extends Command
3939

4040
private array $supportedShells;
4141

42-
protected function configure()
42+
protected function configure(): void
4343
{
4444
$fullCommand = $_SERVER['PHP_SELF'];
4545
$commandName = basename($fullCommand);

Command/HelpCommand.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ class HelpCommand extends Command
2727
{
2828
private Command $command;
2929

30+
/**
31+
* @return void
32+
*/
3033
protected function configure()
3134
{
3235
$this->ignoreValidationErrors();
@@ -54,6 +57,9 @@ protected function configure()
5457
;
5558
}
5659

60+
/**
61+
* @return void
62+
*/
5763
public function setCommand(Command $command)
5864
{
5965
$this->command = $command;

Command/ListCommand.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
*/
2626
class ListCommand extends Command
2727
{
28+
/**
29+
* @return void
30+
*/
2831
protected function configure()
2932
{
3033
$this

DependencyInjection/AddConsoleCommandPass.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
*/
3030
class AddConsoleCommandPass implements CompilerPassInterface
3131
{
32+
/**
33+
* @return void
34+
*/
3235
public function process(ContainerBuilder $container)
3336
{
3437
$commandServices = $container->findTaggedServiceIds('console.command', true);

Descriptor/ApplicationDescription.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function getCommand(string $name): Command
7979
return $this->commands[$name] ?? $this->aliases[$name];
8080
}
8181

82-
private function inspectApplication()
82+
private function inspectApplication(): void
8383
{
8484
$this->commands = [];
8585
$this->namespaces = [];

Descriptor/Descriptor.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,9 @@
2626
*/
2727
abstract class Descriptor implements DescriptorInterface
2828
{
29-
/**
30-
* @var OutputInterface
31-
*/
32-
protected $output;
29+
protected OutputInterface $output;
3330

34-
public function describe(OutputInterface $output, object $object, array $options = [])
31+
public function describe(OutputInterface $output, object $object, array $options = []): void
3532
{
3633
$this->output = $output;
3734

@@ -45,10 +42,7 @@ public function describe(OutputInterface $output, object $object, array $options
4542
};
4643
}
4744

48-
/**
49-
* Writes content to output.
50-
*/
51-
protected function write(string $content, bool $decorated = false)
45+
protected function write(string $content, bool $decorated = false): void
5246
{
5347
$this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
5448
}

Descriptor/JsonDescriptor.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,30 +26,30 @@
2626
*/
2727
class JsonDescriptor extends Descriptor
2828
{
29-
protected function describeInputArgument(InputArgument $argument, array $options = [])
29+
protected function describeInputArgument(InputArgument $argument, array $options = []): void
3030
{
3131
$this->writeData($this->getInputArgumentData($argument), $options);
3232
}
3333

34-
protected function describeInputOption(InputOption $option, array $options = [])
34+
protected function describeInputOption(InputOption $option, array $options = []): void
3535
{
3636
$this->writeData($this->getInputOptionData($option), $options);
3737
if ($option->isNegatable()) {
3838
$this->writeData($this->getInputOptionData($option, true), $options);
3939
}
4040
}
4141

42-
protected function describeInputDefinition(InputDefinition $definition, array $options = [])
42+
protected function describeInputDefinition(InputDefinition $definition, array $options = []): void
4343
{
4444
$this->writeData($this->getInputDefinitionData($definition), $options);
4545
}
4646

47-
protected function describeCommand(Command $command, array $options = [])
47+
protected function describeCommand(Command $command, array $options = []): void
4848
{
4949
$this->writeData($this->getCommandData($command, $options['short'] ?? false), $options);
5050
}
5151

52-
protected function describeApplication(Application $application, array $options = [])
52+
protected function describeApplication(Application $application, array $options = []): void
5353
{
5454
$describedNamespace = $options['namespace'] ?? null;
5555
$description = new ApplicationDescription($application, $describedNamespace, true);
@@ -81,7 +81,7 @@ protected function describeApplication(Application $application, array $options
8181
/**
8282
* Writes data as json.
8383
*/
84-
private function writeData(array $data, array $options)
84+
private function writeData(array $data, array $options): void
8585
{
8686
$flags = $options['json_encoding'] ?? 0;
8787

0 commit comments

Comments
 (0)