Skip to content

Commit

Permalink
Use null coalescing ?? instead of casting to string
Browse files Browse the repository at this point in the history
  • Loading branch information
pH-7 authored Apr 9, 2022
1 parent f9ec973 commit 34c9e2c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/PhoneDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author Pierre-Henry Soria <[email protected]>
* @link https://pierrehenry.be
* @copyright (c) 2019, Pierre-Henry Soria. All Rights Reserved.
* @copyright (c) 2019-2022, Pierre-Henry Soria. All Rights Reserved.
* @license MIT License
*/

Expand Down Expand Up @@ -40,6 +40,6 @@ private function testUserAgentWith(string $regex): bool

private function getUserAgent(): string
{
return (string)$_SERVER['HTTP_USER_AGENT'];
return $_SERVER['HTTP_USER_AGENT'] ?? '';
}
}

0 comments on commit 34c9e2c

Please sign in to comment.