Skip to content

Commit 8727b61

Browse files
committed
minor #45433 Leverage the match expression (fancyweb)
This PR was merged into the 6.1 branch. Discussion ---------- Leverage the match expression | Q | A | ------------- | --- | Branch? | 6.1 | Bug fix? | no | New feature? | no | Deprecations? | - | Tickets | - | License | MIT | Doc PR | - Tentative to leverage the `match` expression when we can in order to keep on modernizing the code (after `array_is_list()`, `str_starts_with()`, `str_ends_with()` and `str_contains()`). Firstly, let's see if the CI is green. Commits ------- 217dc16187 Leverage the match expression
2 parents 90bb6ec + 9f20f0b commit 8727b61

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

Notification/Notification.php

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -167,17 +167,12 @@ protected function getDefaultEmoji(): string
167167
return '';
168168
}
169169

170-
switch ($this->importance) {
171-
case self::IMPORTANCE_URGENT:
172-
return '🌩️';
173-
case self::IMPORTANCE_HIGH:
174-
return '🌧️';
175-
case self::IMPORTANCE_MEDIUM:
176-
return '🌦️';
177-
case self::IMPORTANCE_LOW:
178-
default:
179-
return '';
180-
}
170+
return match ($this->importance) {
171+
self::IMPORTANCE_URGENT => '🌩️',
172+
self::IMPORTANCE_HIGH => '🌧️',
173+
self::IMPORTANCE_MEDIUM => '🌦️',
174+
default => '',
175+
};
181176
}
182177

183178
private function computeExceptionAsString(\Throwable $exception): string

0 commit comments

Comments
 (0)