diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 6b51ada..772444d 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -106,7 +106,6 @@ - iso_code]]> currencies]]> diff --git a/src/GeoIP.php b/src/GeoIP.php index cbfa223..83bd00a 100644 --- a/src/GeoIP.php +++ b/src/GeoIP.php @@ -269,9 +269,14 @@ private function isValid($ip): bool * @param string|null $ip * * @return bool + * @psalm-assert-if-true string $ip */ - private function shouldCache(Location $location, $ip = null): bool + private function shouldCache(Location $location, ?string $ip = null): bool { + if ($ip === null) { + return false; + } + if ($location->default === true || $location->cached === true) { return false; }