Skip to content

Commit

Permalink
style: simplify the options initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
xHeaven committed Jan 18, 2025
1 parent 43a6fde commit d9b8846
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Tempest/Validation/src/Rules/IPv4.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@ public function __construct(
private bool $allowPrivateRange = true,
private bool $allowReservedRange = true,
) {
$options = 0;
$options = $options | FILTER_FLAG_IPV4;
$options = FILTER_FLAG_IPV4;

if (! $this->allowPrivateRange) {
$options = $options | FILTER_FLAG_NO_PRIV_RANGE;
$options |= FILTER_FLAG_NO_PRIV_RANGE;
}

if (! $this->allowReservedRange) {
$options = $options | FILTER_FLAG_NO_RES_RANGE;
$options |= FILTER_FLAG_NO_RES_RANGE;
}

$this->options = $options;
Expand Down

0 comments on commit d9b8846

Please sign in to comment.