Skip to content

Commit 42d3e74

Browse files
committed
Repair language-iso and name check of composer.json
1 parent 4b49c5b commit 42d3e74

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/Phpbb/TranslationValidator/Validator/FileValidator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -560,9 +560,9 @@ public function validateJsonFile($originFile)
560560
$fileContents = (string) file_get_contents($this->originPath . '/' . $originFile);
561561
$jsonContent = json_decode($fileContents, true);
562562

563-
if (!$jsonContent['name'] == (substr($originFile, 21) === 'phpbb/phpbb-language-'))
563+
if (!str_starts_with($jsonContent['name'], 'phpbb/phpbb-language-'))
564564
{
565-
$this->output->addMessage(Output::FATAL, 'File must have name value which starts with phpbb/phpbb-language- following by the language iso code', $originFile);
565+
$this->output->addMessage(Output::FATAL, 'Name should start with phpbb/phpbb-language- followed by the language iso code', $originFile);
566566
}
567567

568568
if (!array_key_exists('description', $jsonContent))
@@ -617,7 +617,7 @@ public function validateJsonFile($originFile)
617617
$this->output->addMessage(Output::FATAL, 'The extra section is missing.', $originFile);
618618
}
619619
// language-iso must be valid
620-
if (preg_match('/^(?:[a-z]*_?){0,2}[a-z]*$/', $jsonContent['extra']['language-iso']))
620+
if (!preg_match('/^(?:[a-z]*_?){0,2}[a-z]*$/', $jsonContent['extra']['language-iso']))
621621
{
622622
$this->output->addMessage(Output::FATAL, 'The language-iso should only contain small letters from a to z and maximum two underscores.', $originFile);
623623
}

0 commit comments

Comments
 (0)