From 23ba48c71f0d41bbe012d668349f6516dad527b4 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Fri, 5 Sep 2025 09:56:46 -0400 Subject: Change how files are included (#7916) 1. `include`, `include_once`, `require` and `require_once` are expressions not functions, parentheses are not necessary. 2. to move up the directory tree, it's better to use the `dirname` function instead of relying on `/..`. --- cli/check.translation.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'cli/check.translation.php') diff --git a/cli/check.translation.php b/cli/check.translation.php index 151a6084f..01e90a631 100755 --- a/cli/check.translation.php +++ b/cli/check.translation.php @@ -6,7 +6,7 @@ require_once __DIR__ . '/i18n/I18nCompletionValidator.php'; require_once __DIR__ . '/i18n/I18nData.php'; require_once __DIR__ . '/i18n/I18nFile.php'; require_once __DIR__ . '/i18n/I18nUsageValidator.php'; -require_once __DIR__ . '/../constants.php'; +require_once dirname(__DIR__) . '/constants.php'; $cliOptions = new class extends CliOptionsParser { /** @var array $language */ @@ -104,7 +104,7 @@ function embedSvg(string $contents): string { if ($cliOptions->generateReadme) { $supportedFormats = ['txt', 'svg']; - $flagsDir = __DIR__ . '/../docs/i18n/flags'; + $flagsDir = dirname(__DIR__) . '/docs/i18n/flags'; $markdownImgStr = ''; foreach ($percentage as $lang => $value) { @@ -131,7 +131,7 @@ if ($cliOptions->generateReadme) { $template = '' . "\n"; if ($svg === '') { - $i18nGen = include __DIR__ . "/../app/i18n/$lang/gen.php"; + $i18nGen = include dirname(__DIR__) . "/app/i18n/$lang/gen.php"; if (!is_array($i18nGen) || !is_string($i18nGen['flag'] ?? null)) { echo 'Error: No Unicode flag found for language ' . $lang, PHP_EOL; exit(1); -- cgit v1.2.3