PHPStan level 3 #1603
1 changed files with 3 additions and 3 deletions
Fix error in libravatar addon
commit
2667b4d78e
|
@ -361,19 +361,19 @@ class Services_Libravatar
|
|||
protected function domainGet($identifier)
|
||||
{
|
||||
if ($identifier === null) {
|
||||
return null;
|
||||
return '';
|
||||
}
|
||||
|
||||
// What are we, email or openid? Split ourself up and get the
|
||||
// important bit out.
|
||||
if (filter_var($identifier, FILTER_VALIDATE_EMAIL)) {
|
||||
$email = explode('@', $identifier);
|
||||
return $email[1];
|
||||
return (string) $email[1];
|
||||
Art4 marked this conversation as resolved
Outdated
|
||||
}
|
||||
|
||||
//OpenID
|
||||
$url = parse_url($identifier);
|
||||
$domain = $url['host'];
|
||||
$domain = (string) $url['host'];
|
||||
Art4 marked this conversation as resolved
Outdated
MrPetovan
commented
`parse_url()` only returns an integer for the `port` key, this is superfluous.
Art4
commented
Same as above: #1603 (comment) Same as above: https://git.friendi.ca/friendica/friendica-addons/pulls/1603#issuecomment-196305
|
||||
if (isset($url['port']) && $url['scheme'] === 'http'
|
||||
&& $url['port'] != 80
|
||||
|| isset($url['port']) && $url['scheme'] === 'https'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue
I'm surprised by this,
explode()
reportedly only returns strings in the output array. What case is this meant to address?I was surprised too, but thought PHPStan complains because
explode()
could also returnfalse
. But now I removed the type cast and PHPStan don't show an error anymore. 🤷