Skip to content

Commit 0dea9e3

Browse files
derrabusTobion
authored andcommitted
Add types to constructors and private/final/internal methods (Batch II)
1 parent 101025d commit 0dea9e3

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

Data/Generator/LanguageDataGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ private function generateAlpha3Codes(array $languageCodes, ArrayAccessibleResour
205205
return array_keys($alpha3Codes);
206206
}
207207

208-
private function generateAlpha2ToAlpha3Mapping(ArrayAccessibleResourceBundle $metadataBundle)
208+
private function generateAlpha2ToAlpha3Mapping(ArrayAccessibleResourceBundle $metadataBundle): array
209209
{
210210
$aliases = iterator_to_array($metadataBundle['alias']['language']);
211211
$alpha2ToAlpha3 = [];

Locale.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public static function getDefaultFallback(): ?string
6565
* @return string|null The ICU locale code of the fallback locale, or null
6666
* if no fallback exists
6767
*/
68-
public static function getFallback($locale): ?string
68+
public static function getFallback(string $locale): ?string
6969
{
7070
if (\function_exists('locale_parse')) {
7171
$localeSubTags = locale_parse($locale);

Util/GitRepository.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,32 +44,32 @@ public static function download(string $remote, string $targetDir): self
4444
return new self(realpath($targetDir));
4545
}
4646

47-
public function getPath()
47+
public function getPath(): string
4848
{
4949
return $this->path;
5050
}
5151

52-
public function getUrl()
52+
public function getUrl(): string
5353
{
5454
return $this->getLastLine($this->execInPath('git config --get remote.origin.url'));
5555
}
5656

57-
public function getLastCommitHash()
57+
public function getLastCommitHash(): string
5858
{
5959
return $this->getLastLine($this->execInPath('git log -1 --format="%H"'));
6060
}
6161

62-
public function getLastAuthor()
62+
public function getLastAuthor(): string
6363
{
6464
return $this->getLastLine($this->execInPath('git log -1 --format="%an"'));
6565
}
6666

67-
public function getLastAuthoredDate()
67+
public function getLastAuthoredDate(): \DateTime
6868
{
6969
return new \DateTime($this->getLastLine($this->execInPath('git log -1 --format="%ai"')));
7070
}
7171

72-
public function getLastTag(callable $filter = null)
72+
public function getLastTag(callable $filter = null): string
7373
{
7474
$tags = $this->execInPath('git tag -l --sort=v:refname');
7575

@@ -80,17 +80,17 @@ public function getLastTag(callable $filter = null)
8080
return $this->getLastLine($tags);
8181
}
8282

83-
public function checkout($branch)
83+
public function checkout(string $branch)
8484
{
8585
$this->execInPath(sprintf('git checkout %s', escapeshellarg($branch)));
8686
}
8787

88-
private function execInPath(string $command)
88+
private function execInPath(string $command): array
8989
{
9090
return self::exec(sprintf('cd %s && %s', escapeshellarg($this->path), $command));
9191
}
9292

93-
private static function exec($command, $customErrorMessage = null)
93+
private static function exec(string $command, string $customErrorMessage = null): array
9494
{
9595
exec(sprintf('%s 2>&1', $command), $output, $result);
9696

@@ -101,7 +101,7 @@ private static function exec($command, $customErrorMessage = null)
101101
return $output;
102102
}
103103

104-
private function getLastLine(array $output)
104+
private function getLastLine(array $output): string
105105
{
106106
return array_pop($output);
107107
}

0 commit comments

Comments
 (0)