mvc: make getCurrentValue() never return null; closes #8195

This commit is contained in:
Franco Fichtner 2025-01-09 14:02:38 +01:00
parent be42113aa5
commit 03bd82881f
2 changed files with 5 additions and 5 deletions

View File

@ -360,14 +360,14 @@ abstract class BaseField
*/
public function __toString()
{
return $this->getCurrentValue() ?? '';
return $this->getCurrentValue();
}
/**
* return field current value
* @return null|string field current value
*/
public function getCurrentValue(): ?string
public function getCurrentValue(): string
{
return (string)$this->internalValue;
}

View File

@ -112,7 +112,7 @@ class LinkAddressField extends BaseField
*/
public function getDescription()
{
$value = $this->getCurrentValue() ?? '';
$value = $this->getCurrentValue();
if (isset(self::$known_addresses[$value])) {
return self::$known_addresses[$value];
@ -124,7 +124,7 @@ class LinkAddressField extends BaseField
/**
* return either ipaddr or if field, only one should be used, addresses are preferred.
*/
public function getCurrentValue(): ?string
public function getCurrentValue(): string
{
$parent = $this->getParentNode();
@ -134,7 +134,7 @@ class LinkAddressField extends BaseField
}
}
return null;
return '';
}
/**