Improve / make more explicit: type safety

This commit is contained in:
Joshua Ramon Enslin 2020-10-04 23:59:40 +02:00 committed by Stefan Rohde-Enslin
parent 97566ea2d9
commit 99aa1d74ad

View File

@ -634,7 +634,7 @@ final class NodaTimeAutotranslater {
*/
public static function translateYearsAfterStart(array $timeInfo):array {
if (empty(trim($timeInfo['zeit_zaehlzeit_monat'], " ,.;0"))) {
if (empty(trim((string)$timeInfo['zeit_zaehlzeit_monat'], " ,.;0"))) {
$timeInfo['zeit_beginn'] = strval(intval($timeInfo['zeit_beginn']) - 1);
}
# else throw new Exception("Unhandled split case. Counting time is: " . var_export($timeInfo, true));
@ -665,7 +665,7 @@ final class NodaTimeAutotranslater {
$start = intval($timeInfo['zeit_beginn']);
if (substr($timeInfo['zeit_name'], 0, 5) === "Nach ") {
if (substr((string)$timeInfo['zeit_name'], 0, 5) === "Nach ") {
return self::translateYearsAfterStart($timeInfo);
}
@ -694,7 +694,7 @@ final class NodaTimeAutotranslater {
*/
public static function translateYearsBeforeEnd(array $timeInfo):array {
if (empty(trim($timeInfo['zeit_zaehlzeit_monat'], " ,.;0"))) {
if (empty(trim((string)$timeInfo['zeit_zaehlzeit_monat'], " ,.;0"))) {
$timeInfo['zeit_ende'] = strval(intval($timeInfo['zeit_ende']) + 1);
}
$end = intval($timeInfo['zeit_ende']);
@ -725,7 +725,7 @@ final class NodaTimeAutotranslater {
$end = intval($timeInfo['zeit_ende']);
if (substr($timeInfo['zeit_name'], 0, 4) === "Vor ") {
if (substr((string)$timeInfo['zeit_name'], 0, 4) === "Vor ") {
return self::translateYearsBeforeEnd($timeInfo);
}