Skip to content

Commit f970ac2

Browse files
authored
Small change to improve code reading
Small change to improve the reading and understanding of the code, for not type conflict.
1 parent c605069 commit f970ac2

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

system/Validation/FormatRules.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -266,19 +266,19 @@ public function valid_ip(?string $ip = null, ?string $which = null): bool
266266

267267
switch (strtolower($which ?? '')) {
268268
case 'ipv4':
269-
$which = FILTER_FLAG_IPV4;
269+
$option = FILTER_FLAG_IPV4;
270270
break;
271271

272272
case 'ipv6':
273-
$which = FILTER_FLAG_IPV6;
273+
$option = FILTER_FLAG_IPV6;
274274
break;
275275

276276
default:
277-
$which = 0;
277+
$option = 0;
278278
}
279279

280-
return filter_var($ip, FILTER_VALIDATE_IP, $which) !== false
281-
|| (! ctype_print($ip) && filter_var(inet_ntop($ip), FILTER_VALIDATE_IP, $which) !== false);
280+
return filter_var($ip, FILTER_VALIDATE_IP, $option) !== false
281+
|| (! ctype_print($ip) && filter_var(inet_ntop($ip), FILTER_VALIDATE_IP, $option) !== false);
282282
}
283283

284284
/**

0 commit comments

Comments
 (0)