Skip to content

Commit

Permalink
Fix deprecated call to trim() with a null value (#2)
Browse files Browse the repository at this point in the history
Fixes warning: Passing null to parameter #1 ($string) of type string is deprecated
  • Loading branch information
ivanvermeyen committed Feb 19, 2022
1 parent 4eafad1 commit a3fd02a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/BrowserLocale.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ protected function makeLocale($httpAcceptLanguage)
*/
protected function split($string, $delimiter)
{
if ( ! $string) {
return [];
}

return explode($delimiter, trim($string)) ?: [];
}

Expand Down

0 comments on commit a3fd02a

Please sign in to comment.