Skip to content

Commit

Permalink
style: fix coding styles (#475)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbalandan authored Jan 26, 2025
1 parent 19502ed commit c0378e6
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@
return Factory::create(new CodeIgniter4(), $overrides, $options)->forLibrary(
'CodeIgniter 4 framework',
'CodeIgniter Foundation',
'[email protected]'
'[email protected]',
);
12 changes: 6 additions & 6 deletions bin/generate-changelog
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if (! isset($argv[1]) || ! in_array($argv[1], ['--major', '--minor', '--patch'],
CLI::error(
'Please provide the tagging strategy for this release: --major, --minor, --patch.',
'light_gray',
'red'
'red',
);

exit(1);
Expand Down Expand Up @@ -74,7 +74,7 @@ $nextTag = preg_replace_callback(
return sprintf('v%d.0.0', ++$matches[1]);
}
},
$latestTag
$latestTag,
);

CLI::write(sprintf('Generating changelog for %s...', $nextTag), 'green');
Expand All @@ -101,9 +101,9 @@ foreach ($changelog as $log) {
static fn (array $matches): string => preg_replace(
'/(?<!^)((?=[\p{Lu}][^\p{Lu}])|(?<![\p{Lu}])(?=[\p{Lu}]))/u',
' ',
$matches[1]
$matches[1],
),
$class
$class,
);

continue;
Expand Down Expand Up @@ -135,9 +135,9 @@ CLI::write(sprintf(
implode("\n", array_map(
static fn (string $value, string $key): string => sprintf('- %s (%s)', $key, $value),
array_values($localeChanges),
array_keys($localeChanges)
array_keys($localeChanges),
)) ?: '- <none>',
implode("\n- ", $otherChanges) ?: '<none>'
implode("\n- ", $otherChanges) ?: '<none>',
));

sleep(1); // for cinematic effect
Expand Down
8 changes: 4 additions & 4 deletions bin/generate-page
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ $enFiles = get_filenames(
$enDir,
true,
false,
false
false,
);

$enItems = [];
Expand Down Expand Up @@ -112,7 +112,7 @@ foreach ($locales as $localeKey => $locale) {
$langDir,
true,
false,
false
false,
);

$items[$locale] = [
Expand All @@ -121,9 +121,9 @@ foreach ($locales as $localeKey => $locale) {
static fn (array $matches): string => preg_replace(
'/(?<!^)((?=[\p{Lu}][^\p{Lu}])|(?<![\p{Lu}])(?=[\p{Lu}]))/u',
' ',
$matches[1]
$matches[1],
),
$localeKey
$localeKey,
),
'locale' => $locale,
'percent' => 0,
Expand Down
2 changes: 1 addition & 1 deletion bin/test
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ if ($argc === 2) {
CLI::write(
'The following locales have untranslated items:',
'light_gray',
'red'
'red',
);
exec($phpunit, $output, $resultCode);

Expand Down
4 changes: 2 additions & 2 deletions bin/update-en-comments
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ $files = get_filenames(
$langDir,
true,
false,
false
false,
);

$enFiles = get_filenames(
$enDir,
true,
false,
false
false,
);

foreach ($enFiles as $enFile) {
Expand Down
6 changes: 3 additions & 3 deletions tests/AutoReview/TranslationsCodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function testAllTranslatedLocalesAreIncludedInTheReadMe(): void
foreach ($this->locales() as $locale) {
$this->assertSame(1, preg_match(sprintf('/\| %s \s+\|/', $locale), $readme), sprintf(
'The locale "%s" is not found in the README.md file. Please add it.',
$locale
$locale,
));
}
}
Expand All @@ -53,7 +53,7 @@ public function testAllTranslatedLocalesAreNotIncludedInMissing(): void
foreach ($this->locales() as $locale) {
$this->assertSame(0, preg_match(sprintf('/\| %s \s+\|/', $locale), $missing), sprintf(
'The locale "%s" is already translated and should no longer be found in MISSING.md file.',
$locale
$locale,
));
}
}
Expand All @@ -79,7 +79,7 @@ private function getContentsOrFail(string $filepath): string
if ($contents === false) {
$this->fail(sprintf(
'Failed to get the contents of %s. It is either not found or not readable.',
basename($filepath)
basename($filepath),
));
}

Expand Down
24 changes: 12 additions & 12 deletions tests/Language/AbstractTranslationTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ final public function testAllConfiguredLanguageFilesAreTranslated(string $locale
{
$filesNotTranslated = array_diff(
$this->expectedSets(),
$this->foundSets($locale)
$this->foundSets($locale),
);

sort($filesNotTranslated);
Expand All @@ -113,7 +113,7 @@ final public function testAllConfiguredLanguageFilesAreTranslated(string $locale
$count > 1 ? 'files' : 'file',
implode('", "', $filesNotTranslated),
$count > 1 ? 'are' : 'is',
$locale
$locale,
));
}

Expand All @@ -126,7 +126,7 @@ final public function testAllTranslatedLanguageFilesAreConfigured(string $locale
{
$filesNotConfigured = array_diff(
$this->foundSets($locale),
$this->expectedSets()
$this->expectedSets(),
);

sort($filesNotConfigured);
Expand All @@ -137,7 +137,7 @@ final public function testAllTranslatedLanguageFilesAreConfigured(string $locale
$count > 1 ? 'files' : 'file',
implode('", "', $filesNotConfigured),
$locale,
$count > 1 ? 'are' : 'is'
$count > 1 ? 'are' : 'is',
));
}

Expand All @@ -153,7 +153,7 @@ final public function testAllConfiguredLanguageKeysAreIncluded(string $locale):
foreach ($this->foundSets($locale) as $file) {
$missing = array_diff_key(
$this->loadFile($file),
$this->loadFile($file, $locale)
$this->loadFile($file, $locale),
);

foreach (array_keys($missing) as $key) {
Expand All @@ -169,7 +169,7 @@ final public function testAllConfiguredLanguageKeysAreIncluded(string $locale):
$count > 1 ? 'keys' : 'key',
implode('", "', $keysNotIncluded),
$count > 1 ? 'are' : 'is',
$locale
$locale,
));
}

Expand All @@ -185,7 +185,7 @@ final public function testAllIncludedLanguageKeysAreConfigured(string $locale):
foreach ($this->foundSets($locale) as $file) {
$extra = array_diff_key(
$this->loadFile($file, $locale),
$this->loadFile($file)
$this->loadFile($file),
);

foreach (array_keys($extra) as $key) {
Expand All @@ -201,7 +201,7 @@ final public function testAllIncludedLanguageKeysAreConfigured(string $locale):
$count > 1 ? 'keys' : 'key',
implode('", "', $keysNotConfigured),
$locale,
$count > 1 ? 'are' : 'is'
$count > 1 ? 'are' : 'is',
));
}

Expand Down Expand Up @@ -253,7 +253,7 @@ final public function testAllIncludedLanguageKeysAreTranslated(string $locale):
$count > 1 ? 'keys' : 'key',
implode('", "', $keysNotTranslated),
$locale,
$count > 1 ? 'differ' : 'differs'
$count > 1 ? 'differ' : 'differs',
));
}

Expand Down Expand Up @@ -283,7 +283,7 @@ final public function testAllConfiguredLanguageKeysAreInOrder(string $locale): v
"\n%s:\n%s\n%s",
$file,
CLI::color("-'{$expectedKey}' => '{$original[$expectedKey]}';", 'red'),
CLI::color("+'{$actualKey}' => '{$translated[$actualKey]}';", 'green')
CLI::color("+'{$actualKey}' => '{$translated[$actualKey]}';", 'green'),
);
break;
}
Expand All @@ -295,7 +295,7 @@ final public function testAllConfiguredLanguageKeysAreInOrder(string $locale): v
"Failed asserting that the translated language keys in \"%s\" locale are ordered correctly.\n%s\n%s",
$locale,
CLI::color('--- Original', 'red') . "\n" . CLI::color('+++ Translated', 'green'),
implode("\n", $diffs)
implode("\n", $diffs),
));
}

Expand All @@ -320,7 +320,7 @@ final public function testLocaleHasCorrespondingTestCaseFile(string $locale): vo

$this->assertTrue(class_exists($class, false), sprintf(
'Failed asserting that test class "%s" is existing.',
$class
$class,
));
}

Expand Down

0 comments on commit c0378e6

Please sign in to comment.