Turns array return to yield in data providers
use PHPUnit\Framework\TestCase;
final class SomeTest implements TestCase
{
public static function provideData()
{
- return [
- ['some text']
- ];
+ yield ['some text'];
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\PHPUnit\CodeQuality\Rector\Class_\YieldDataProviderRector;
return RectorConfig::configure()
->withRules([
YieldDataProviderRector::class,
]);