Skip to content

Commit 4224e48

Browse files
committed
refactor: review commands
1 parent 24d6800 commit 4224e48

File tree

2 files changed

+12
-34
lines changed

2 files changed

+12
-34
lines changed

Command/ExtractTranslationCommand.php

+6-15
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,11 @@
3737
*/
3838
class ExtractTranslationCommand extends Command
3939
{
40-
/**
41-
* @var ConfigFactory
42-
*/
43-
private $configFactory;
40+
private ConfigFactory $configFactory;
4441

45-
/**
46-
* @var Updater
47-
*/
48-
private $updater;
42+
private Updater $updater;
4943

50-
/**
51-
* @var array
52-
*/
53-
private $locales;
44+
private array $locales;
5445

5546
public function __construct(ConfigFactory $configFactory, Updater $updater, array $locales)
5647
{
@@ -142,18 +133,18 @@ protected function execute(InputInterface $input, OutputInterface $output): int
142133
}
143134
}
144135

145-
return 0;
136+
return Command::SUCCESS;
146137
}
147138

148139
$this->updater->process($config);
149140
}
150141

151142
$output->writeln('done!');
152143

153-
return 0;
144+
return Command::SUCCESS;
154145
}
155146

156-
private function updateWithInput(InputInterface $input, ConfigBuilder $builder)
147+
private function updateWithInput(InputInterface $input, ConfigBuilder $builder): void
157148
{
158149
if ($bundle = $input->getOption('bundle')) {
159150
if ('@' === $bundle[0]) {

Command/ResourcesListCommand.php

+6-19
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,14 @@
3232
*/
3333
class ResourcesListCommand extends Command
3434
{
35-
/**
36-
* @var string
37-
*/
38-
private $projectDir;
35+
private string $projectDir;
3936

4037
/**
4138
* @var string|null
4239
*/
4340
private $rootDir;
4441

45-
/**
46-
* @var array
47-
*/
48-
private $bundles;
42+
private array $bundles;
4943

5044
public function __construct(string $projectDir, array $bundles, ?string $rootDir)
5145
{
@@ -88,7 +82,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8882

8983
$output->writeln('done!');
9084

91-
return 0;
85+
return Command::SUCCESS;
9286
}
9387

9488
$output->writeln('<info>Resources list :</info>');
@@ -102,15 +96,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
10296

10397
$output->writeln('done!');
10498

105-
return 0;
99+
return Command::SUCCESS;
106100
}
107101

108-
/**
109-
* @param array $dirs
110-
*
111-
* @return array
112-
*/
113-
private function retrieveFiles(array $dirs)
102+
private function retrieveFiles(array $dirs): array
114103
{
115104
$files = [];
116105
// Register translation resources
@@ -127,10 +116,8 @@ private function retrieveFiles(array $dirs)
127116

128117
/**
129118
* The following methods is derived from code of the FrameworkExtension.php file from the Symfony2 framework
130-
*
131-
* @return array
132119
*/
133-
private function retrieveDirs()
120+
private function retrieveDirs(): array
134121
{
135122
// Discover translation directories
136123
$dirs = [];

0 commit comments

Comments
 (0)