Skip to content

Commit

Permalink
Accept null in Ip::isValid()
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Wright <[email protected]>
  • Loading branch information
betterthanclay committed Oct 30, 2023
1 parent 77999ac commit aa41d00
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
* Accept null in Ip::isValid()

## v0.1.4 (2023-10-30)
* Added isValid()

Expand Down
6 changes: 5 additions & 1 deletion src/Ip.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,12 @@ public static function parse(
* Validate IP or return null
*/
public static function isValid(
Ip|string|int|BigInteger $ip,
Ip|string|int|BigInteger|null $ip,
): bool {
if ($ip === null) {
return false;
}

if ($ip instanceof Ip) {
return true;
}
Expand Down

0 comments on commit aa41d00

Please sign in to comment.