Skip to content

Commit b70eb70

Browse files
wouterjnicolas-grekas
authored andcommitted
[Components] Convert to native return types
1 parent 6bcf1e4 commit b70eb70

26 files changed

+59
-209
lines changed

Catalogue/AbstractOperation.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,6 @@ public function moveMessagesToIntlDomainsIfPossible(string $batch = self::ALL_BA
183183
* stores the results.
184184
*
185185
* @param string $domain The domain which the operation will be performed for
186-
*
187-
* @return void
188186
*/
189-
abstract protected function processDomain(string $domain);
187+
abstract protected function processDomain(string $domain): void;
190188
}

Catalogue/MergeOperation.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@
2424
*/
2525
class MergeOperation extends AbstractOperation
2626
{
27-
/**
28-
* @return void
29-
*/
30-
protected function processDomain(string $domain)
27+
protected function processDomain(string $domain): void
3128
{
3229
$this->messages[$domain] = [
3330
'all' => [],

Catalogue/TargetOperation.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@
2525
*/
2626
class TargetOperation extends AbstractOperation
2727
{
28-
/**
29-
* @return void
30-
*/
31-
protected function processDomain(string $domain)
28+
protected function processDomain(string $domain): void
3229
{
3330
$this->messages[$domain] = [
3431
'all' => [],

CatalogueMetadataAwareInterface.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,14 @@ public function getCatalogueMetadata(string $key = '', string $domain = 'message
3131

3232
/**
3333
* Adds catalogue metadata to a message domain.
34-
*
35-
* @return void
3634
*/
37-
public function setCatalogueMetadata(string $key, mixed $value, string $domain = 'messages');
35+
public function setCatalogueMetadata(string $key, mixed $value, string $domain = 'messages'): void;
3836

3937
/**
4038
* Deletes catalogue metadata for the given key and domain.
4139
*
4240
* Passing an empty domain will delete all catalogue metadata. Passing an empty key will
4341
* delete all metadata for the given domain.
44-
*
45-
* @return void
4642
*/
47-
public function deleteCatalogueMetadata(string $key = '', string $domain = 'messages');
43+
public function deleteCatalogueMetadata(string $key = '', string $domain = 'messages'): void;
4844
}

Command/XliffLintCommand.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,7 @@ public function __construct(string $name = null, callable $directoryIteratorProv
5050
$this->requireStrictFileNames = $requireStrictFileNames;
5151
}
5252

53-
/**
54-
* @return void
55-
*/
56-
protected function configure()
53+
protected function configure(): void
5754
{
5855
$this
5956
->addArgument('filename', InputArgument::IS_ARRAY, 'A file, a directory or "-" for reading from STDIN')

DataCollectorTranslator.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,7 @@ public function trans(?string $id, array $parameters = [], string $domain = null
4848
return $trans;
4949
}
5050

51-
/**
52-
* @return void
53-
*/
54-
public function setLocale(string $locale)
51+
public function setLocale(string $locale): void
5552
{
5653
$this->translator->setLocale($locale);
5754
}
@@ -95,10 +92,7 @@ public function getFallbackLocales(): array
9592
return [];
9693
}
9794

98-
/**
99-
* @return mixed
100-
*/
101-
public function __call(string $method, array $args)
95+
public function __call(string $method, array $args): mixed
10296
{
10397
return $this->translator->{$method}(...$args);
10498
}

DependencyInjection/TranslationDumperPass.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@
2020
*/
2121
class TranslationDumperPass implements CompilerPassInterface
2222
{
23-
/**
24-
* @return void
25-
*/
26-
public function process(ContainerBuilder $container)
23+
public function process(ContainerBuilder $container): void
2724
{
2825
if (!$container->hasDefinition('translation.writer')) {
2926
return;

DependencyInjection/TranslationExtractorPass.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@
2121
*/
2222
class TranslationExtractorPass implements CompilerPassInterface
2323
{
24-
/**
25-
* @return void
26-
*/
27-
public function process(ContainerBuilder $container)
24+
public function process(ContainerBuilder $container): void
2825
{
2926
if (!$container->hasDefinition('translation.extractor')) {
3027
return;

DependencyInjection/TranslatorPass.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@
1818

1919
class TranslatorPass implements CompilerPassInterface
2020
{
21-
/**
22-
* @return void
23-
*/
24-
public function process(ContainerBuilder $container)
21+
public function process(ContainerBuilder $container): void
2522
{
2623
if (!$container->hasDefinition('translator.default')) {
2724
return;

DependencyInjection/TranslatorPathsPass.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,7 @@ class TranslatorPathsPass extends AbstractRecursivePass
4242
*/
4343
private array $controllers = [];
4444

45-
/**
46-
* @return void
47-
*/
48-
public function process(ContainerBuilder $container)
45+
public function process(ContainerBuilder $container): void
4946
{
5047
if (!$container->hasDefinition('translator')) {
5148
return;

Dumper/CsvFileDumper.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,8 @@ public function formatCatalogue(MessageCatalogue $messages, string $domain, arra
4040

4141
/**
4242
* Sets the delimiter and escape character for CSV.
43-
*
44-
* @return void
4543
*/
46-
public function setCsvControl(string $delimiter = ';', string $enclosure = '"')
44+
public function setCsvControl(string $delimiter = ';', string $enclosure = '"'): void
4745
{
4846
$this->delimiter = $delimiter;
4947
$this->enclosure = $enclosure;

Dumper/DumperInterface.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ interface DumperInterface
2525
* Dumps the message catalogue.
2626
*
2727
* @param array $options Options that are used by the dumper
28-
*
29-
* @return void
3028
*/
31-
public function dump(MessageCatalogue $messages, array $options = []);
29+
public function dump(MessageCatalogue $messages, array $options = []): void;
3230
}

Dumper/FileDumper.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,13 @@ abstract class FileDumper implements DumperInterface
3636
* Sets the template for the relative paths to files.
3737
*
3838
* @param string $relativePathTemplate A template for the relative paths to files
39-
*
40-
* @return void
4139
*/
42-
public function setRelativePathTemplate(string $relativePathTemplate)
40+
public function setRelativePathTemplate(string $relativePathTemplate): void
4341
{
4442
$this->relativePathTemplate = $relativePathTemplate;
4543
}
4644

47-
/**
48-
* @return void
49-
*/
50-
public function dump(MessageCatalogue $messages, array $options = [])
45+
public function dump(MessageCatalogue $messages, array $options = []): void
5146
{
5247
if (!\array_key_exists('path', $options)) {
5348
throw new InvalidArgumentException('The file dumper needs a path option.');

Extractor/AbstractFileExtractor.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,7 @@ protected function isFile(string $file): bool
5555
return true;
5656
}
5757

58-
/**
59-
* @return bool
60-
*/
61-
abstract protected function canBeExtracted(string $file);
58+
abstract protected function canBeExtracted(string $file): bool;
6259

63-
/**
64-
* @return iterable
65-
*/
66-
abstract protected function extractFromDirectory(string|array $resource);
60+
abstract protected function extractFromDirectory(string|array $resource): iterable;
6761
}

Extractor/ChainExtractor.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,20 @@ class ChainExtractor implements ExtractorInterface
2929

3030
/**
3131
* Adds a loader to the translation extractor.
32-
*
33-
* @return void
3432
*/
35-
public function addExtractor(string $format, ExtractorInterface $extractor)
33+
public function addExtractor(string $format, ExtractorInterface $extractor): void
3634
{
3735
$this->extractors[$format] = $extractor;
3836
}
3937

40-
/**
41-
* @return void
42-
*/
43-
public function setPrefix(string $prefix)
38+
public function setPrefix(string $prefix): void
4439
{
4540
foreach ($this->extractors as $extractor) {
4641
$extractor->setPrefix($prefix);
4742
}
4843
}
4944

50-
/**
51-
* @return void
52-
*/
53-
public function extract(string|iterable $directory, MessageCatalogue $catalogue)
45+
public function extract(string|iterable $directory, MessageCatalogue $catalogue): void
5446
{
5547
foreach ($this->extractors as $extractor) {
5648
$extractor->extract($directory, $catalogue);

Extractor/ExtractorInterface.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,11 @@ interface ExtractorInterface
2525
* Extracts translation messages from files, a file or a directory to the catalogue.
2626
*
2727
* @param string|iterable<string> $resource Files, a file or a directory
28-
*
29-
* @return void
3028
*/
31-
public function extract(string|iterable $resource, MessageCatalogue $catalogue);
29+
public function extract(string|iterable $resource, MessageCatalogue $catalogue): void;
3230

3331
/**
3432
* Sets the prefix that should be used for new found messages.
35-
*
36-
* @return void
3733
*/
38-
public function setPrefix(string $prefix);
34+
public function setPrefix(string $prefix): void;
3935
}

Loader/CsvFileLoader.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,8 @@ protected function loadResource(string $resource): array
5252

5353
/**
5454
* Sets the delimiter, enclosure, and escape character for CSV.
55-
*
56-
* @return void
5755
*/
58-
public function setCsvControl(string $delimiter = ';', string $enclosure = '"', string $escape = '\\')
56+
public function setCsvControl(string $delimiter = ';', string $enclosure = '"', string $escape = '\\'): void
5957
{
6058
$this->delimiter = $delimiter;
6159
$this->enclosure = $enclosure;

LoggingTranslator.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,7 @@ public function trans(?string $id, array $parameters = [], string $domain = null
4545
return $trans;
4646
}
4747

48-
/**
49-
* @return void
50-
*/
51-
public function setLocale(string $locale)
48+
public function setLocale(string $locale): void
5249
{
5350
$prev = $this->translator->getLocale();
5451
$this->translator->setLocale($locale);
@@ -86,10 +83,7 @@ public function getFallbackLocales(): array
8683
return [];
8784
}
8885

89-
/**
90-
* @return mixed
91-
*/
92-
public function __call(string $method, array $args)
86+
public function __call(string $method, array $args): mixed
9387
{
9488
return $this->translator->{$method}(...$args);
9589
}

MessageCatalogue.php

Lines changed: 10 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,7 @@ public function all(string $domain = null): array
8080
return $allMessages;
8181
}
8282

83-
/**
84-
* @return void
85-
*/
86-
public function set(string $id, string $translation, string $domain = 'messages')
83+
public function set(string $id, string $translation, string $domain = 'messages'): void
8784
{
8885
$this->add([$id => $translation], $domain);
8986
}
@@ -123,20 +120,14 @@ public function get(string $id, string $domain = 'messages'): string
123120
return $id;
124121
}
125122

126-
/**
127-
* @return void
128-
*/
129-
public function replace(array $messages, string $domain = 'messages')
123+
public function replace(array $messages, string $domain = 'messages'): void
130124
{
131125
unset($this->messages[$domain], $this->messages[$domain.self::INTL_DOMAIN_SUFFIX]);
132126

133127
$this->add($messages, $domain);
134128
}
135129

136-
/**
137-
* @return void
138-
*/
139-
public function add(array $messages, string $domain = 'messages')
130+
public function add(array $messages, string $domain = 'messages'): void
140131
{
141132
$altDomain = str_ends_with($domain, self::INTL_DOMAIN_SUFFIX) ? substr($domain, 0, -\strlen(self::INTL_DOMAIN_SUFFIX)) : $domain.self::INTL_DOMAIN_SUFFIX;
142133
foreach ($messages as $id => $message) {
@@ -149,10 +140,7 @@ public function add(array $messages, string $domain = 'messages')
149140
}
150141
}
151142

152-
/**
153-
* @return void
154-
*/
155-
public function addCatalogue(MessageCatalogueInterface $catalogue)
143+
public function addCatalogue(MessageCatalogueInterface $catalogue): void
156144
{
157145
if ($catalogue->getLocale() !== $this->locale) {
158146
throw new LogicException(sprintf('Cannot add a catalogue for locale "%s" as the current locale for this catalogue is "%s".', $catalogue->getLocale(), $this->locale));
@@ -181,10 +169,7 @@ public function addCatalogue(MessageCatalogueInterface $catalogue)
181169
}
182170
}
183171

184-
/**
185-
* @return void
186-
*/
187-
public function addFallbackCatalogue(MessageCatalogueInterface $catalogue)
172+
public function addFallbackCatalogue(MessageCatalogueInterface $catalogue): void
188173
{
189174
// detect circular references
190175
$c = $catalogue;
@@ -223,10 +208,7 @@ public function getResources(): array
223208
return array_values($this->resources);
224209
}
225210

226-
/**
227-
* @return void
228-
*/
229-
public function addResource(ResourceInterface $resource)
211+
public function addResource(ResourceInterface $resource): void
230212
{
231213
$this->resources[$resource->__toString()] = $resource;
232214
}
@@ -250,18 +232,12 @@ public function getMetadata(string $key = '', string $domain = 'messages'): mixe
250232
return null;
251233
}
252234

253-
/**
254-
* @return void
255-
*/
256-
public function setMetadata(string $key, mixed $value, string $domain = 'messages')
235+
public function setMetadata(string $key, mixed $value, string $domain = 'messages'): void
257236
{
258237
$this->metadata[$domain][$key] = $value;
259238
}
260239

261-
/**
262-
* @return void
263-
*/
264-
public function deleteMetadata(string $key = '', string $domain = 'messages')
240+
public function deleteMetadata(string $key = '', string $domain = 'messages'): void
265241
{
266242
if ('' == $domain) {
267243
$this->metadata = [];
@@ -291,18 +267,12 @@ public function getCatalogueMetadata(string $key = '', string $domain = 'message
291267
return null;
292268
}
293269

294-
/**
295-
* @return void
296-
*/
297-
public function setCatalogueMetadata(string $key, mixed $value, string $domain = 'messages')
270+
public function setCatalogueMetadata(string $key, mixed $value, string $domain = 'messages'): void
298271
{
299272
$this->catalogueMetadata[$domain][$key] = $value;
300273
}
301274

302-
/**
303-
* @return void
304-
*/
305-
public function deleteCatalogueMetadata(string $key = '', string $domain = 'messages')
275+
public function deleteCatalogueMetadata(string $key = '', string $domain = 'messages'): void
306276
{
307277
if (!$domain) {
308278
$this->catalogueMetadata = [];

0 commit comments

Comments
 (0)