use string class to avoid prefixing on downgrade by TomasVotruba · Pull Request #307 · rectorphp/rector-phpunit · GitHub
Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 3 additions & 4 deletions composer.json
18 changes: 5 additions & 13 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,14 @@
declare(strict_types=1);

use Symplify\EasyCodingStandard\Config\ECSConfig;
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;

return static function (ECSConfig $ecsConfig): void {
$ecsConfig->sets([SetList::SYMPLIFY, SetList::COMMON, SetList::CLEAN_CODE, SetList::PSR_12]);

$ecsConfig->paths([
return ECSConfig::configure()
->withPreparedSets(psr12: true, common: true, symplify: true)
->withPaths([
__DIR__ . '/src',
__DIR__ . '/rules',
__DIR__ . '/rules-tests',
__DIR__ . '/tests',
__DIR__ . '/config',
__DIR__ . '/ecs.php',
__DIR__ . '/rector.php',
]);

$ecsConfig->skip(['*/Source/*', '*/Fixture/*', '*/Expected/*']);

$ecsConfig->lineEnding("\n");
};
])
->withSkip(['*/Source/*', '*/Fixture/*', '*/Expected/*']);
1 change: 1 addition & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
__DIR__ . '/src/Rector/Class_/TestListenerToHooksRector.php',
__DIR__ . '/src/NodeAnalyzer/TestsNodeAnalyzer.php',
__DIR__ . '/config',
__DIR__ . '/src/NodeFinder/DataProviderClassMethodFinder.php',
],
]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
declare(strict_types=1);

use Rector\Config\RectorConfig;

use Rector\PHPUnit\CodeQuality\Rector\MethodCall\AssertEmptyNullableObjectToAssertInstanceofRector;

return static function (RectorConfig $rectorConfig): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
declare(strict_types=1);

use Rector\Config\RectorConfig;

use Rector\PHPUnit\PHPUnit100\Rector\Class_\PublicDataProviderClassMethodRector;

return static function (RectorConfig $rectorConfig): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
declare(strict_types=1);

use Rector\Config\RectorConfig;

use Rector\PHPUnit\PHPUnit100\Rector\Class_\StaticDataProviderClassMethodRector;

return static function (RectorConfig $rectorConfig): void {
Expand Down
6 changes: 4 additions & 2 deletions src/NodeFinder/DataProviderClassMethodFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use PhpParser\Node\Stmt\ClassMethod;
use PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode;
use PHPStan\Reflection\ClassReflection;
use PHPUnit\Framework\Attributes\DataProvider;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
use Rector\NodeNameResolver\NodeNameResolver;
use Rector\PhpParser\AstResolver;
Expand Down Expand Up @@ -64,7 +63,10 @@ public function find(Class_ $class): array
*/
public function findDataProviderNamesForClassMethod(ClassMethod $classMethod): array
{
$dataProviderAttributes = $this->findAttributesByClass($classMethod, DataProvider::class);
$dataProviderAttributes = $this->findAttributesByClass(
$classMethod,
'PHPUnit\Framework\Attributes\DataProvider'
);

if ($dataProviderAttributes !== []) {
return $this->resolveAttributeMethodNames($dataProviderAttributes);
Expand Down
1 change: 0 additions & 1 deletion tests/Issues/DoubleAnnotation/DoubleAnnotationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Rector\PHPUnit\Tests\Issues\DoubleAnnotation;

use Iterator;

use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Rector\PHPUnit\Tests\Issues\PHPUnit10DataProvider;

use Iterator;

use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;

Expand Down
1 change: 0 additions & 1 deletion tests/Issues/RectorOrder/RectorOrderTest.php