Improve type-safety / explicitness
This commit is contained in:
parent
e4558ae227
commit
dd2fbafd25
@ -166,7 +166,7 @@ final class NodaTimeAutotranslater {
|
||||
if (intval($zeit_ende) >= 0 && intval($zeit_beginn) < 0) {
|
||||
return self::TRANSLATABLE_NOT;
|
||||
}
|
||||
if (intval($zeit_ende) < 1000 || intval($zeit_ende) < 0 && intval($zeit_beginn) < 0) {
|
||||
if (intval($zeit_ende) < 0 && intval($zeit_beginn) < 0 || intval($zeit_ende) < 1000) {
|
||||
return self::TRANSLATABLE_AS_YEAR_WITH_SUFFIX;
|
||||
}
|
||||
// Conditions speaking against translatability.
|
||||
@ -235,7 +235,7 @@ final class NodaTimeAutotranslater {
|
||||
*/
|
||||
public function translate(array $timeInfo):void {
|
||||
|
||||
if (!($translation_type = self::check_translatability($timeInfo['zeit_beginn'], $timeInfo['zeit_ende'], (string)$timeInfo['zeit_zaehlzeit_monat']))) {
|
||||
if (!($translation_type = self::check_translatability((string)$timeInfo['zeit_beginn'], (string)$timeInfo['zeit_ende'], (string)$timeInfo['zeit_zaehlzeit_monat']))) {
|
||||
throw new MDgenericInvalidInputsException("Non-translatable date");
|
||||
}
|
||||
|
||||
|
@ -195,10 +195,10 @@ final class NodaTimeSplitter {
|
||||
else if (intval($moda[2]) !== 0 and intval($moda[3]) !== 0) {
|
||||
return "{$moda[3]}.{$moda[2]}.{$moda[0]}{$suffix}";
|
||||
}
|
||||
else if ($moda[0] === $moda[1] && trim($moda[2], " 0") === "" && trim($moda[3], " 0") === "") {
|
||||
else if ($moda[0] === $moda[1] && trim((string)$moda[2], " 0") === "" && trim((string)$moda[3], " 0") === "") {
|
||||
return "{$moda[0]}{$suffix}";
|
||||
}
|
||||
else if ($moda[0] === $moda[1] && trim($moda[2], " 0") !== "" && trim($moda[3], " 0") === "") {
|
||||
else if ($moda[0] === $moda[1] && trim((string)$moda[2], " 0") !== "" && trim((string)$moda[3], " 0") === "") {
|
||||
setlocale(LC_TIME, NodaTimeAutotranslater::LANGS_TO_LOCALES['de']);
|
||||
return strftime(getMonthFormatByLang("de"), MD_STD::strtotime("{$moda[0]}-{$moda[2]}-01 01:01:01")) . $suffix;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user