Change data provider methods to static
use PHPUnit\Framework\TestCase;
final class SomeTest extends TestCase
{
/**
* @dataProvider provideData()
*/
public function test()
{
}
- public function provideData()
+ public static function provideData()
{
yield [1];
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\PHPUnit\PHPUnit100\Rector\Class_\StaticDataProviderClassMethodRector;
return RectorConfig::configure()
->withRules([
StaticDataProviderClassMethodRector::class,
]);