Skip to content

Commit 34c9e2c

Browse files
authored
Use null coalescing ?? instead of casting to string
1 parent f9ec973 commit 34c9e2c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/PhoneDetector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* @author Pierre-Henry Soria <hi@ph7.me>
44
* @link https://pierrehenry.be
5-
* @copyright (c) 2019, Pierre-Henry Soria. All Rights Reserved.
5+
* @copyright (c) 2019-2022, Pierre-Henry Soria. All Rights Reserved.
66
* @license MIT License
77
*/
88

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

4141
private function getUserAgent(): string
4242
{
43-
return (string)$_SERVER['HTTP_USER_AGENT'];
43+
return $_SERVER['HTTP_USER_AGENT'] ?? '';
4444
}
4545
}

0 commit comments

Comments
 (0)