Test Failed
Push — master ( 1a9cc9...cac184 )
by Morten
25:35
created

src/Resolvers/IpAddressResolver.php (2 issues)

1
<?php
2
3
namespace OwenIt\Auditing\Resolvers;
4
5
use Illuminate\Support\Facades\Request;
6
use OwenIt\Auditing\Contracts\Auditable;
7
use OwenIt\Auditing\Contracts\Resolver;
8
9
class IpAddressResolver implements Resolver
10
{
11 136
    public static function resolve(Auditable $auditable): string
12
    {
13 136
        return $auditable->preloadedResolverData['ip_address'] ?? Request::ip();
0 ignored issues
show
Bug Best Practice introduced by
The expression return $auditable->prelo...t\Facades\Request::ip() could return the type null which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
Accessing preloadedResolverData on the interface OwenIt\Auditing\Contracts\Auditable suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
14
    }
15
}
16