Skip to content

Commit dac4f0e

Browse files
tareqasnicolas-grekas
authored andcommitted
Add some return types
1 parent ae45069 commit dac4f0e

File tree

9 files changed

+24
-16
lines changed

9 files changed

+24
-16
lines changed

Cli/Application.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function getApi()
6969
return $this->api;
7070
}
7171

72-
public function getLongVersion()
72+
public function getLongVersion(): string
7373
{
7474
$version = parent::getLongVersion().' by <comment>Symfony</comment>';
7575
$commit = '@git-commit@';
@@ -116,7 +116,7 @@ protected function getDefaultCommands(): array
116116
return $defaultCommands;
117117
}
118118

119-
protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
119+
protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output): int
120120
{
121121
if (!$command instanceof LocalCommand\NeedConfigurationInterface) {
122122
return parent::doRunCommand($command, $input, $output);

Cli/Command/AnalysisCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
class AnalysisCommand extends Command implements NeedConfigurationInterface
2222
{
23-
protected function configure()
23+
protected function configure(): void
2424
{
2525
$this
2626
->setName('analysis')
@@ -32,7 +32,7 @@ protected function configure()
3232
;
3333
}
3434

35-
protected function execute(InputInterface $input, OutputInterface $output)
35+
protected function execute(InputInterface $input, OutputInterface $output): int
3636
{
3737
$api = $this->getApplication()->getApi();
3838
$analysis = $api->getProject($input->getArgument('project-uuid'))->getLastAnalysis();

Cli/Command/AnalyzeCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
class AnalyzeCommand extends Command implements NeedConfigurationInterface
2424
{
25-
protected function configure()
25+
protected function configure(): void
2626
{
2727
$this
2828
->setName('analyze')
@@ -38,7 +38,7 @@ protected function configure()
3838
;
3939
}
4040

41-
protected function execute(InputInterface $input, OutputInterface $output)
41+
protected function execute(InputInterface $input, OutputInterface $output): int
4242
{
4343
$projectUuid = $input->getArgument('project-uuid');
4444

Cli/Command/ConfigureCommand.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,18 @@
1717

1818
class ConfigureCommand extends Command
1919
{
20-
protected function configure()
20+
protected function configure(): void
2121
{
2222
$this
2323
->setName('configure')
2424
->setDescription('(Re-)Configure your credentials.')
2525
;
2626
}
2727

28-
protected function execute(InputInterface $input, OutputInterface $output)
28+
protected function execute(InputInterface $input, OutputInterface $output): int
2929
{
3030
$this->getHelperSet()->get('configuration')->updateConfigurationManually($input, $output);
31+
32+
return 0;
3133
}
3234
}

Cli/Command/ProjectsCommand.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818

1919
class ProjectsCommand extends Command implements NeedConfigurationInterface
2020
{
21-
protected function configure()
21+
protected function configure(): void
2222
{
2323
$this
2424
->setName('projects')
2525
->setDescription('List all your projects')
2626
;
2727
}
2828

29-
protected function execute(InputInterface $input, OutputInterface $output)
29+
protected function execute(InputInterface $input, OutputInterface $output): int
3030
{
3131
$api = $this->getApplication()->getApi();
3232

@@ -58,5 +58,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
5858
->setRows($rows)
5959
->render()
6060
;
61+
62+
return 0;
6163
}
6264
}

Cli/Command/SelfUpdateCommand.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class SelfUpdateCommand extends Command
2525
/**
2626
* {@inheritdoc}
2727
*/
28-
protected function configure()
28+
protected function configure(): void
2929
{
3030
$this
3131
->setName('self-update')
@@ -44,7 +44,7 @@ protected function configure()
4444
/**
4545
* {@inheritdoc}
4646
*/
47-
protected function execute(InputInterface $input, OutputInterface $output)
47+
protected function execute(InputInterface $input, OutputInterface $output): int
4848
{
4949
$remoteFilename = 'http://get.insight.sensiolabs.com/insight.phar';
5050
$localFilename = $_SERVER['argv'][0];
@@ -57,7 +57,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
5757
$output->writeln('<info>insight is already up to date.</info>');
5858
unlink($tempFilename);
5959

60-
return;
60+
return 0;
6161
}
6262

6363
chmod($tempFilename, 0777 & ~umask());
@@ -69,13 +69,17 @@ protected function execute(InputInterface $input, OutputInterface $output)
6969
rename($tempFilename, $localFilename);
7070

7171
$output->writeln('<info>insight updated.</info>');
72+
73+
return 0;
7274
} catch (\Exception $e) {
7375
if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) {
7476
throw $e;
7577
}
7678
unlink($tempFilename);
7779
$output->writeln('<error>The download is corrupt ('.$e->getMessage().').</error>');
7880
$output->writeln('<error>Please re-run the self-update command to try again.</error>');
81+
82+
return 1;
7983
}
8084
}
8185
}

Cli/Helper/ConfigurationHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function getConfiguration(InputInterface $input, OutputInterface $output)
6262
return $configuration;
6363
}
6464

65-
public function getName()
65+
public function getName(): string
6666
{
6767
return 'configuration';
6868
}

Cli/Helper/DescriptorHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function register($format, AbstractDescriptor $descriptor)
6161
/**
6262
* {@inheritdoc}
6363
*/
64-
public function getName()
64+
public function getName(): string
6565
{
6666
return 'descriptor';
6767
}

Cli/Helper/FailConditionHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function evaluate(Analysis $analysis, $expr)
6969
return 0;
7070
}
7171

72-
public function getName()
72+
public function getName(): string
7373
{
7474
return 'fail_condition';
7575
}

0 commit comments

Comments
 (0)