@@ -46,7 +46,11 @@ public function testSupports(Constraint $constraint, ApiProperty $propertyMetada
4646 public static function supportsProvider (): \Generator
4747 {
4848 yield 'email ' => [new Email (), new ApiProperty (), true ];
49- yield 'url ' => [new Url (), new ApiProperty (), true ];
49+ if (property_exists (Url::class, 'requireTld ' )) {
50+ yield 'url ' => [new Url (requireTld: true ), new ApiProperty (), true ];
51+ } else {
52+ yield 'url ' => [new Url (), new ApiProperty (), true ];
53+ }
5054 if (class_exists (Hostname::class)) {
5155 yield 'hostname ' => [new Hostname (), new ApiProperty (), true ];
5256 }
@@ -67,7 +71,11 @@ public function testCreate(Constraint $constraint, ApiProperty $propertyMetadata
6771 public static function createProvider (): \Generator
6872 {
6973 yield 'email ' => [new Email (), new ApiProperty (), ['format ' => 'email ' ]];
70- yield 'url ' => [new Url (), new ApiProperty (), ['format ' => 'uri ' ]];
74+ if (property_exists (Url::class, 'requireTld ' )) {
75+ yield 'url ' => [new Url (requireTld: true ), new ApiProperty (), ['format ' => 'uri ' ]];
76+ } else {
77+ yield 'url ' => [new Url (), new ApiProperty (), ['format ' => 'uri ' ]];
78+ }
7179 if (class_exists (Hostname::class)) {
7280 yield 'hostname ' => [new Hostname (), new ApiProperty (), ['format ' => 'hostname ' ]];
7381 }
0 commit comments