Skip to content

Commit ff0f7f0

Browse files
committed
#42 Fix type issue
1 parent 397fff7 commit ff0f7f0

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

psalm-baseline.xml

-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@
106106
<code><![CDATA[\InteractionDesignFoundation\GeoIP\Contracts\ServiceInterface]]></code>
107107
</MoreSpecificReturnType>
108108
<PossiblyNullArgument>
109-
<code><![CDATA[$ip]]></code>
110109
<code><![CDATA[$location->iso_code]]></code>
111110
<code><![CDATA[$this->currencies]]></code>
112111
</PossiblyNullArgument>

src/GeoIP.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,14 @@ private function isValid($ip): bool
269269
* @param string|null $ip
270270
*
271271
* @return bool
272+
* @psalm-assert-if-true string $ip
272273
*/
273-
private function shouldCache(Location $location, $ip = null): bool
274+
private function shouldCache(Location $location, ?string $ip = null): bool
274275
{
276+
if ($ip === null) {
277+
return false;
278+
}
279+
275280
if ($location->default === true || $location->cached === true) {
276281
return false;
277282
}

0 commit comments

Comments
 (0)