Update CanFormatState.php

This commit is contained in:
Dan Harrin
2022-10-13 10:06:44 +01:00
parent df2976c504
commit e9f8555fe9
@@ -137,13 +137,7 @@ trait CanFormatState
public function getFormattedState()
{
$state = $this->getState();
if ($this->formatStateUsing) {
$state = $this->evaluate($this->formatStateUsing, [
'state' => $state,
]);
}
$state = $this->evaluate($this->formatStateUsing ?? fn ($state) => $state);
if ($this->prefix) {
$state = $this->evaluate($this->prefix) . $state;