Skip to content

Commit 115391c

Browse files
fix: url deprecation
1 parent 362c0f1 commit 115391c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/Symfony/Tests/Validator/Metadata/Property/Restriction/PropertySchemaFormatTest.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)