@@ -57,8 +57,9 @@ public function testValidate(
5757 ?string $ defaultRegion = null ,
5858 ?string $ regionPath = null ,
5959 PhoneNumberFormat |int |null $ format = null ,
60+ ?string $ requiredRegion = null ,
6061 ): void {
61- $ constraint = new PhoneNumber ($ format , $ type , $ defaultRegion , $ regionPath );
62+ $ constraint = new PhoneNumber ($ format , $ type , $ defaultRegion , $ regionPath, requiredRegion: $ requiredRegion );
6263
6364 if (true === $ violates ) {
6465 $ constraintViolationBuilder = $ this ->createMock (ConstraintViolationBuilderInterface::class);
@@ -112,8 +113,18 @@ public function testValidateFromAttribute(): void
112113 * 2 => Type (optional)
113114 * 3 => Default region (optional).
114115 * 4 => Region Path (optional).
116+ * 5 => Format (optional)
117+ * 6 => Required region (optional).
115118 *
116- * @return iterable<array{string|LibPhoneNumber|null, bool, 2?: string|string[]|null, 3?: ?string, 4?: ?string, 5?: PhoneNumberFormat|int|null}>
119+ * @return iterable<array{
120+ * string|LibPhoneNumber|null,
121+ * bool,
122+ * 2?: string|string[]|null,
123+ * 3?: ?string,
124+ * 4?: ?string,
125+ * 5?: PhoneNumberFormat|int|null,
126+ * 6?: string|null
127+ * }>
117128 */
118129 public function validateProvider (): iterable
119130 {
@@ -160,6 +171,8 @@ public function validateProvider(): iterable
160171 yield ['+33606060606 ' , false , 'mobile ' , null , 'regionPath ' ];
161172 yield ['+33606060606 ' , false , 'mobile ' , null , null , PhoneNumberFormat::E164 ];
162173 yield ['2015555555 ' , true , null , null , null , PhoneNumberFormat::E164 ];
174+ yield ['+33650505050 ' , false , null , null , null , PhoneNumberFormat::E164 , 'FR ' ];
175+ yield ['+33650505050 ' , true , null , null , null , PhoneNumberFormat::E164 , 'EN ' ];
163176
164177 // Ensure BC promise is respected
165178 yield ['+33606060606 ' , false , 'mobile ' , null , null , 0 ];
0 commit comments