Skip to content

Commit a3fd02a

Browse files
committed
Fix deprecated call to trim() with a null value (#2)
Fixes warning: Passing null to parameter #1 ($string) of type string is deprecated
1 parent 4eafad1 commit a3fd02a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/BrowserLocale.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ protected function makeLocale($httpAcceptLanguage)
109109
*/
110110
protected function split($string, $delimiter)
111111
{
112+
if ( ! $string) {
113+
return [];
114+
}
115+
112116
return explode($delimiter, trim($string)) ?: [];
113117
}
114118

0 commit comments

Comments
 (0)