File tree Expand file tree Collapse file tree 4 files changed +10
-20
lines changed
Expand file tree Collapse file tree 4 files changed +10
-20
lines changed Original file line number Diff line number Diff line change @@ -16,16 +16,14 @@ public function __construct(
1616 private bool $ allowPrivateRange = true ,
1717 private bool $ allowReservedRange = true ,
1818 ) {
19- $ options = 0 ;
20- $ options = $ options | FILTER_FLAG_IPV4 ;
21- $ options = $ options | FILTER_FLAG_IPV6 ;
19+ $ options = FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6 ;
2220
2321 if (! $ this ->allowPrivateRange ) {
24- $ options = $ options | FILTER_FLAG_NO_PRIV_RANGE ;
22+ $ options |= FILTER_FLAG_NO_PRIV_RANGE ;
2523 }
2624
2725 if (! $ this ->allowReservedRange ) {
28- $ options = $ options | FILTER_FLAG_NO_RES_RANGE ;
26+ $ options |= FILTER_FLAG_NO_RES_RANGE ;
2927 }
3028
3129 $ this ->options = $ options ;
Original file line number Diff line number Diff line change @@ -16,15 +16,14 @@ public function __construct(
1616 private bool $ allowPrivateRange = true ,
1717 private bool $ allowReservedRange = true ,
1818 ) {
19- $ options = 0 ;
20- $ options = $ options | FILTER_FLAG_IPV4 ;
19+ $ options = FILTER_FLAG_IPV4 ;
2120
2221 if (! $ this ->allowPrivateRange ) {
23- $ options = $ options | FILTER_FLAG_NO_PRIV_RANGE ;
22+ $ options |= FILTER_FLAG_NO_PRIV_RANGE ;
2423 }
2524
2625 if (! $ this ->allowReservedRange ) {
27- $ options = $ options | FILTER_FLAG_NO_RES_RANGE ;
26+ $ options |= FILTER_FLAG_NO_RES_RANGE ;
2827 }
2928
3029 $ this ->options = $ options ;
Original file line number Diff line number Diff line change @@ -16,15 +16,14 @@ public function __construct(
1616 private bool $ allowPrivateRange = true ,
1717 private bool $ allowReservedRange = true ,
1818 ) {
19- $ options = 0 ;
20- $ options = $ options | FILTER_FLAG_IPV6 ;
19+ $ options = FILTER_FLAG_IPV6 ;
2120
2221 if (! $ this ->allowPrivateRange ) {
23- $ options = $ options | FILTER_FLAG_NO_PRIV_RANGE ;
22+ $ options |= FILTER_FLAG_NO_PRIV_RANGE ;
2423 }
2524
2625 if (! $ this ->allowReservedRange ) {
27- $ options = $ options | FILTER_FLAG_NO_RES_RANGE ;
26+ $ options |= FILTER_FLAG_NO_RES_RANGE ;
2827 }
2928
3029 $ this ->options = $ options ;
Original file line number Diff line number Diff line change @@ -39,14 +39,8 @@ public function test_ip_address_without_private_range(): void
3939
4040 public function test_ip_address_without_reserved_range (): void
4141 {
42- if (PHP_OS_FAMILY === 'Windows ' ) {
43- $ this ->markTestSkipped ('Some kind of problem with Windows. Needs further investigation. ' );
44- /** @phpstan-ignore-next-line */
45- return ;
46- }
47-
4842 $ rule = new IPv6 (allowReservedRange: false );
49- $ this ->assertFalse ($ rule ->isValid ('2001:db8:ffff:ffff:ffff:ffff:ffff:ffff ' ));
43+ $ this ->assertFalse ($ rule ->isValid ('::1 ' ));
5044 $ this ->assertTrue ($ rule ->isValid ('2a03:b0c0:3:d0::11f5:3001 ' ));
5145
5246 $ rule = new IPv6 (allowReservedRange: true );
You can’t perform that action at this time.
0 commit comments