aboutsummaryrefslogtreecommitdiff
path: root/cli/i18n/I18nCompletionValidator.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2023-03-31 08:23:39 +0200
committerGravatar GitHub <noreply@github.com> 2023-03-31 08:23:39 +0200
commit288ed04ccc30b58373576dc3be811aee43e67034 (patch)
tree27f4c571e04d64c97737416dfa2b8d65f481dfd8 /cli/i18n/I18nCompletionValidator.php
parentc9d5fe2da12cbc3a071ebf9a518afe2789bb3d61 (diff)
PHPStan level 6 for all PDO and Exception classes (#5239)
* PHPStan level 6 for all PDO and Exception classes Contributes to https://github.com/FreshRSS/FreshRSS/issues/4112 * Fix type * Now also our remaining own librairies * Motivation for a few more files * A few more DAO classes * Last interface
Diffstat (limited to 'cli/i18n/I18nCompletionValidator.php')
-rw-r--r--cli/i18n/I18nCompletionValidator.php17
1 files changed, 13 insertions, 4 deletions
diff --git a/cli/i18n/I18nCompletionValidator.php b/cli/i18n/I18nCompletionValidator.php
index 000629f8d..3903e18cd 100644
--- a/cli/i18n/I18nCompletionValidator.php
+++ b/cli/i18n/I18nCompletionValidator.php
@@ -4,18 +4,27 @@ require_once __DIR__ . '/I18nValidatorInterface.php';
class I18nCompletionValidator implements I18nValidatorInterface {
+ /** @var array<string,array<string,I18nValue>> */
private $reference;
+ /** @var array<string,array<string,I18nValue>> */
private $language;
+ /** @var int */
private $totalEntries = 0;
+ /** @var int */
private $passEntries = 0;
+ /** @var string */
private $result = '';
- public function __construct($reference, $language) {
+ /**
+ * @param array<string,array<string,I18nValue>> $reference
+ * @param array<string,array<string,I18nValue>> $language
+ */
+ public function __construct(array $reference, array $language) {
$this->reference = $reference;
$this->language = $language;
}
- public function displayReport() {
+ public function displayReport(): string {
if ($this->passEntries > $this->totalEntries) {
throw new \RuntimeException('The number of translated strings cannot be higher than the number of strings');
}
@@ -25,11 +34,11 @@ class I18nCompletionValidator implements I18nValidatorInterface {
return sprintf('Translation is %5.1f%% complete.', $this->passEntries / $this->totalEntries * 100) . PHP_EOL;
}
- public function displayResult() {
+ public function displayResult(): string {
return $this->result;
}
- public function validate() {
+ public function validate(): bool {
foreach ($this->reference as $file => $data) {
foreach ($data as $refKey => $refValue) {
$this->totalEntries++;