1414 */
1515class DataProviderDataRuleTest extends RuleTestCase
1616{
17+ private int $ phpunitVersion ;
1718
1819 protected function getRule (): Rule
1920 {
@@ -24,13 +25,13 @@ protected function getRule(): Rule
2425 new DataProviderDataRule (
2526 new TestMethodsHelper (
2627 self ::getContainer ()->getByType (FileTypeMapper::class),
27- true
28+ new PHPUnitVersion ( $ this -> phpunitVersion )
2829 ),
2930 new DataProviderHelper (
3031 $ reflectionProvider ,
3132 self ::getContainer ()->getByType (FileTypeMapper::class),
3233 self ::getContainer ()->getService ('defaultAnalysisParser ' ),
33- true
34+ new PHPUnitVersion ( $ this -> phpunitVersion )
3435 ),
3536
3637 ),
@@ -42,6 +43,8 @@ protected function getRule(): Rule
4243
4344 public function testRule (): void
4445 {
46+ $ this ->phpunitVersion = 10 ;
47+
4548 $ this ->analyse ([__DIR__ . '/data/data-provider-data.php ' ], [
4649 [
4750 'Parameter #2 $input of method DataProviderDataTest\FooTest::testWithAttribute() expects string, int given. ' ,
@@ -176,6 +179,8 @@ public function testRulePhp8(): void
176179 self ::markTestSkipped ();
177180 }
178181
182+ $ this ->phpunitVersion = 10 ;
183+
179184 $ this ->analyse ([__DIR__ . '/data/data-provider-data-named.php ' ], [
180185 [
181186 'Parameter $input of method DataProviderDataTestPhp8\NamedArgsInProvider::testFoo() expects string, int given. ' ,
@@ -203,6 +208,8 @@ public function testRulePhp8(): void
203208
204209 public function testVariadicMethod (): void
205210 {
211+ $ this ->phpunitVersion = 10 ;
212+
206213 $ this ->analyse ([__DIR__ . '/data/data-provider-variadic-method.php ' ], [
207214 [
208215 'Method DataProviderVariadicMethod\FooTest::testProvide2() invoked with 1 parameter, at least 2 required. ' ,
@@ -241,6 +248,8 @@ public function testVariadicMethod(): void
241248
242249 public function testTrimmingArgs (): void
243250 {
251+ $ this ->phpunitVersion = 10 ;
252+
244253 $ this ->analyse ([__DIR__ . '/data/data-provider-trimming-args.php ' ], [
245254 [
246255 'Method DataProviderTrimmingArgs\FooTest::testProvide() invoked with 2 parameters, 1 required. ' ,
0 commit comments