From 3f5b34fc1ffa22203bbaa80364a9d47757e7827c Mon Sep 17 00:00:00 2001 From: ErickSkrauch Date: Tue, 9 Jan 2018 01:23:11 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D1=87=D0=B8=D1=82=D1=8B=D0=B2=D0=B0?= =?UTF-8?q?=D0=B5=D0=BC=20=D0=B2=D0=B5=D1=80=D0=BE=D1=8F=D1=82=D0=BD=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D1=8C=20=D0=BF=D0=BE=D0=BB=D1=83=D1=87=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20null-=D0=B5=D0=B2=D0=BE=D0=B3=D0=BE=20=D0=B7?= =?UTF-8?q?=D0=BD=D0=B0=D1=87=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B2=20=D0=BD?= =?UTF-8?q?=D0=B0=D1=88=D1=83=20=D1=80=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D1=8E=20trim?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/helpers/StringHelper.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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); }