1212namespace Symfony \Component \OptionsResolver \Tests ;
1313
1414use PHPUnit \Framework \Assert ;
15+ use PHPUnit \Framework \Attributes \DataProvider ;
1516use PHPUnit \Framework \TestCase ;
1617use Symfony \Component \OptionsResolver \Debug \OptionsResolverIntrospector ;
1718use Symfony \Component \OptionsResolver \Exception \AccessException ;
@@ -33,9 +34,7 @@ protected function setUp(): void
3334 $ this ->resolver = new OptionsResolver ();
3435 }
3536
36- /**
37- * @dataProvider provideResolveWithIgnoreUndefined
38- */
37+ #[DataProvider('provideResolveWithIgnoreUndefined ' )]
3938 public function testResolveWithIgnoreUndefined (array $ defaults , array $ options , array $ expected )
4039 {
4140 $ this ->resolver
@@ -541,9 +540,7 @@ public function testIsNotDeprecatedIfEmptyString()
541540 $ this ->assertFalse ($ this ->resolver ->isDeprecated ('foo ' ));
542541 }
543542
544- /**
545- * @dataProvider provideDeprecationData
546- */
543+ #[DataProvider('provideDeprecationData ' )]
547544 public function testDeprecationMessages (\Closure $ configureOptions , array $ options , ?array $ expectedError , int $ expectedCount )
548545 {
549546 $ count = 0 ;
@@ -907,9 +904,7 @@ public function testResolveFailsWithCorrectLevelsButWrongScalar()
907904 ]);
908905 }
909906
910- /**
911- * @dataProvider provideInvalidTypes
912- */
907+ #[DataProvider('provideInvalidTypes ' )]
913908 public function testResolveFailsIfInvalidType ($ actualType , $ allowedType , $ exceptionMessage )
914909 {
915910 $ this ->resolver ->setDefined ('option ' );
@@ -2001,19 +1996,15 @@ public function testNestedArraysException()
20011996 ]);
20021997 }
20031998
2004- /**
2005- * @dataProvider provideValidDeeplyNestedUnionTypes
2006- */
1999+ #[DataProvider('provideValidDeeplyNestedUnionTypes ' )]
20072000 public function testDeeplyNestedUnionTypes (string $ type , $ validValue )
20082001 {
20092002 $ this ->resolver ->setDefined ('option ' );
20102003 $ this ->resolver ->setAllowedTypes ('option ' , $ type );
20112004 $ this ->assertEquals (['option ' => $ validValue ], $ this ->resolver ->resolve (['option ' => $ validValue ]));
20122005 }
20132006
2014- /**
2015- * @dataProvider provideInvalidDeeplyNestedUnionTypes
2016- */
2007+ #[DataProvider('provideInvalidDeeplyNestedUnionTypes ' )]
20172008 public function testDeeplyNestedUnionTypesException (string $ type , $ invalidValue , string $ expectedExceptionMessage )
20182009 {
20192010 $ this ->resolver ->setDefined ('option ' );
0 commit comments