diff options
| author | 2024-04-10 15:33:43 +0200 | |
|---|---|---|
| committer | 2024-04-10 15:33:43 +0200 | |
| commit | 350edf398c55b472e19a3017de9b4d2d3420b9e4 (patch) | |
| tree | 00672f4cba0830e4b39f778e3a36de6b961fc5bb /cli/i18n | |
| parent | 8280e3d88edb93211fcf2aec15a7b4c1ae4d3813 (diff) | |
PHP 8.3 #[\Override] (#6273)
* PHP 8.3 #[\Override]
https://php.watch/versions/8.3/override-attr
With PHPStan `checkMissingOverrideMethodAttribute` https://phpstan.org/config-reference#checkmissingoverridemethodattribute
And modified the call to phpstan-next on the model of https://github.com/FreshRSS/Extensions/pull/228 (more robust than the find method, which gave some strange errors)
* Update extension example accordingly
Diffstat (limited to 'cli/i18n')
| -rw-r--r-- | cli/i18n/I18nCompletionValidator.php | 3 | ||||
| -rw-r--r-- | cli/i18n/I18nUsageValidator.php | 3 | ||||
| -rw-r--r-- | cli/i18n/I18nValue.php | 1 |
3 files changed, 7 insertions, 0 deletions
diff --git a/cli/i18n/I18nCompletionValidator.php b/cli/i18n/I18nCompletionValidator.php index 4a8e54759..2a42dc13f 100644 --- a/cli/i18n/I18nCompletionValidator.php +++ b/cli/i18n/I18nCompletionValidator.php @@ -22,6 +22,7 @@ class I18nCompletionValidator implements I18nValidatorInterface { $this->language = $language; } + #[\Override] 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'); @@ -32,10 +33,12 @@ class I18nCompletionValidator implements I18nValidatorInterface { return sprintf('Translation is %5.1f%% complete.', $this->passEntries / $this->totalEntries * 100) . PHP_EOL; } + #[\Override] public function displayResult(): string { return $this->result; } + #[\Override] public function validate(): bool { foreach ($this->reference as $file => $data) { foreach ($data as $refKey => $refValue) { diff --git a/cli/i18n/I18nUsageValidator.php b/cli/i18n/I18nUsageValidator.php index 1267cd66d..dd514236b 100644 --- a/cli/i18n/I18nUsageValidator.php +++ b/cli/i18n/I18nUsageValidator.php @@ -22,6 +22,7 @@ class I18nUsageValidator implements I18nValidatorInterface { $this->reference = $reference; } + #[\Override] public function displayReport(): string { if ($this->failedEntries > $this->totalEntries) { throw new \RuntimeException('The number of unused strings cannot be higher than the number of strings'); @@ -32,10 +33,12 @@ class I18nUsageValidator implements I18nValidatorInterface { return sprintf('%5.1f%% of translation keys are unused.', $this->failedEntries / $this->totalEntries * 100) . PHP_EOL; } + #[\Override] public function displayResult(): string { return $this->result; } + #[\Override] public function validate(): bool { foreach ($this->reference as $file => $data) { foreach ($data as $key => $value) { diff --git a/cli/i18n/I18nValue.php b/cli/i18n/I18nValue.php index 88d0ea494..03e7676ae 100644 --- a/cli/i18n/I18nValue.php +++ b/cli/i18n/I18nValue.php @@ -66,6 +66,7 @@ class I18nValue { } } + #[\Override] public function __toString(): string { if ($this->state === null) { return $this->value; |
