Fork me on GitHub
a Sensio Labs Product

BoY42 (v3.15.1) edition

Rule php_unit_data_provider_static

Data providers must be static.


Using this rule is risky

Fixer could be risky if one is calling data provider function dynamically.


Example #1

--- Original
+++ New
 class FooTest extends TestCase {
      * @dataProvider provideSomethingCases
     public function testSomething($expected, $actual) {}
-    public function provideSomethingCases() {}
+    public static function provideSomethingCases() {}

Rule sets

The rule is part of the following rule set:


Using the @PHPUnit100Migration:risky rule set will enable the php_unit_data_provider_static rule.

The logo is © 2010-2022 Sensio Labs