Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php

namespace Rector\PHPUnit\Tests\CodeQuality\Rector\Class_\YieldDataProviderRector\Fixture;

use PHPUnit\Framework\TestCase;

final class UseDataProviderTestPhpdoc extends TestCase
{
#[\PHPUnit\Framework\Attributes\DataProvider('dataProvider')]
#[\PHPUnit\Framework\Attributes\DataProvider('provideDataForProvider')]
public function test(string $filePath): void
{
}

/** @return array<int, array<string>> */
public static function provideDataForProvider()
{
return [
['<?php implode("", $foo, );', '<?php implode($foo, "", );']
];
}

public static function dataProvider()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this provider we could add another case with list<...>

{
return [
['<?php implode(\'\', $foo, );', '<?php implode($foo, );'],
['<?php implode(\'\', $foo, );', '<?php implode($foo, );']
];
}
}

?>
-----
<?php

namespace Rector\PHPUnit\Tests\CodeQuality\Rector\Class_\YieldDataProviderRector\Fixture;

use PHPUnit\Framework\TestCase;

final class UseDataProviderTestPhpdoc extends TestCase
{
#[\PHPUnit\Framework\Attributes\DataProvider('dataProvider')]
#[\PHPUnit\Framework\Attributes\DataProvider('provideDataForProvider')]
public function test(string $filePath): void
{
}

/** @return Iterator<int, array<string>> */
public static function provideDataForProvider(): \Iterator
{
yield ['<?php implode("", $foo, );', '<?php implode($foo, "", );'];
}

public static function dataProvider(): \Iterator
{
yield ['<?php implode(\'\', $foo, );', '<?php implode($foo, );'];
yield ['<?php implode(\'\', $foo, );', '<?php implode($foo, );'];
}
}

?>
Loading