Differential D11121 Diff 26717 src/infrastructure/internationalization/translation/PhabricatorTranslation.php
Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/internationalization/translation/PhabricatorTranslation.php
| <?php | <?php | ||||
| abstract class PhabricatorTranslation { | abstract class PhabricatorTranslation { | ||||
| abstract public function getLanguage(); | abstract public function getLanguage(); | ||||
| abstract public function getName(); | abstract public function getName(); | ||||
| abstract public function getTranslations(); | abstract public function getTranslations(); | ||||
| /** | |||||
epriestley: "cleand" -> "cleaned"
For consistency, use full sentences with periods in documentation… | |||||
| * Return the cleaned translation array. | |||||
| * | |||||
| * @return dict<string, wild> Translation map with empty translations removed. | |||||
| */ | |||||
Not Done Inline ActionsFor consistency with getTranslations(), let's call this getCleanTranslations() (i.e., "translations", not "translation"). epriestley: For consistency with `getTranslations()`, let's call this `getCleanTranslations()` (i.e. | |||||
| public function getCleanTranslations() { | |||||
| return $this->clean($this->getTranslations()); | |||||
| } | |||||
| /** | |||||
| * Removes NULL-valued translation keys from the translation map, to prevent | |||||
| * echoing out empty strings. | |||||
| * | |||||
| * @param dict<string, wild> Translation map, with empty translations. | |||||
| * @return dict<string, wild> Map with empty translations removed. | |||||
Not Done Inline ActionsUse an array typehint, since this parameter must always be an array. epriestley: Use an `array` typehint, since this parameter must always be an array. | |||||
| */ | |||||
| protected function clean(array $translation_array) { | |||||
| foreach ($translation_array as $key => $translation_string) { | |||||
| if ($translation_string === null) { | |||||
| unset($translation_array[$key]); | |||||
| } | |||||
| } | |||||
Not Done Inline ActionsBraces aren't aligned. epriestley: Braces aren't aligned. | |||||
| return $translation_array; | |||||
| } | |||||
| } | } | ||||
"cleand" -> "cleaned"
For consistency, use full sentences with periods in documentation: