File tree Expand file tree Collapse file tree 3 files changed +13
-9
lines changed Expand file tree Collapse file tree 3 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ All Notable changes to `PHP Domain Parser` starting from the **5.x** series will
12
12
13
13
- Using PHPUnit 10
14
14
- ` Domain ` decorates the new ` RegisteredName ` class [ #347 ] ( https://github.com/jeremykendall/php-domain-parser/issues/347 )
15
+ - ` Host::withoutLabel ` works without arguments.
15
16
16
17
### Deprecated
17
18
Original file line number Diff line number Diff line change @@ -395,6 +395,13 @@ public function testwithoutLabelWorksWithMultipleKeys(): void
395
395
self ::assertNull (Domain::fromIDNA2008 ('www.example.com ' )->withoutLabel (0 , 1 , 2 )->value ());
396
396
}
397
397
398
+ public function testWithoutLabelWorksWithoutArgument (): void
399
+ {
400
+ $ domain = Domain::fromIDNA2008 ('www.example.com ' );
401
+
402
+ self ::assertSame ($ domain , $ domain ->withoutLabel ());
403
+ }
404
+
398
405
#[DataProvider('resolveCustomIDNAOptionsProvider ' )]
399
406
public function testResolveWorksWithCustomIDNAOptions (
400
407
string $ domainName ,
Original file line number Diff line number Diff line change @@ -81,15 +81,11 @@ public static function fromIDNA2008(DomainNameProvider|Host|Stringable|string|in
81
81
*/
82
82
private function parseDomain (DomainNameProvider |Host |Stringable |string |int |null $ domain ): ?string
83
83
{
84
- if ($ domain instanceof DomainNameProvider) {
85
- $ domain = $ domain ->domain ();
86
- }
87
-
88
- if ($ domain instanceof Host) {
89
- return $ this ->parseValue ($ domain ->toUnicode ()->value ());
90
- }
91
-
92
- return $ this ->parseValue ($ domain );
84
+ return $ this ->parseValue (match (true ) {
85
+ $ domain instanceof DomainNameProvider => $ domain ->domain ()->value (),
86
+ $ domain instanceof Host => $ domain ->toUnicode ()->value (),
87
+ default => $ domain ,
88
+ });
93
89
}
94
90
95
91
/**
You can’t perform that action at this time.
0 commit comments