diff --git a/common/helpers/StringHelper.php b/common/helpers/StringHelper.php index 70d648e..97be7b1 100644 --- a/common/helpers/StringHelper.php +++ b/common/helpers/StringHelper.php @@ -49,7 +49,11 @@ class StringHelper { * @param string $string string to remove whitespaces * @return string trimmed $string */ - public static function trim(string $string): string { + public static function trim(?string $string): string { + if ($string === null) { + return ''; + } + return preg_replace('/^[\pZ\pC]+|[\pZ\pC]+$/u', '', $string); }