File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88use Rector \DeadCode \Rector \If_ \RemoveDeadInstanceOfRector ;
99use Rector \Php80 \Rector \Class_ \StringableForToStringRector ;
1010use Rector \Testing \PHPUnit \AbstractLazyTestCase ;
11- use Rector \Transform \ Rector \ Class_ \ AddInterfaceByTraitRector ;
11+ use Rector \Tests \ Configuration \ Source \ DeprecatedRectorStub ;
1212use Rector \ValueObject \Configuration ;
1313
1414final class ConfigurationRuleFilterTest extends AbstractLazyTestCase
@@ -53,12 +53,12 @@ public function testWithoutPhpOnlyKeepsAllRules(): void
5353 public function testFiltersOutDeprecatedRules (): void
5454 {
5555 $ removeDeadInstanceOfRector = $ this ->make (RemoveDeadInstanceOfRector::class);
56- $ addInterfaceByTraitRector = $ this ->make (AddInterfaceByTraitRector ::class);
56+ $ deprecatedRectorStub = $ this ->make (DeprecatedRectorStub ::class);
5757
5858 $ this ->configurationRuleFilter ->setConfiguration ($ this ->createConfiguration (false ));
5959
6060 $ filteredRectors = $ this ->configurationRuleFilter ->filter (
61- [$ removeDeadInstanceOfRector , $ addInterfaceByTraitRector ]
61+ [$ removeDeadInstanceOfRector , $ deprecatedRectorStub ]
6262 );
6363
6464 $ this ->assertSame ([$ removeDeadInstanceOfRector ], $ filteredRectors );
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Rector \Tests \Configuration \Source ;
6+
7+ use PhpParser \Node ;
8+ use PhpParser \Node \Stmt \Class_ ;
9+ use Rector \Configuration \Deprecation \Contract \DeprecatedInterface ;
10+ use Rector \Rector \AbstractRector ;
11+ use Symplify \RuleDocGenerator \ValueObject \CodeSample \CodeSample ;
12+ use Symplify \RuleDocGenerator \ValueObject \RuleDefinition ;
13+
14+ final class DeprecatedRectorStub extends AbstractRector implements DeprecatedInterface
15+ {
16+ public function getRuleDefinition (): RuleDefinition
17+ {
18+ return new RuleDefinition ('Deprecated stub rule for tests ' , [new CodeSample ('before ' , 'after ' )]);
19+ }
20+
21+ public function getNodeTypes (): array
22+ {
23+ return [Class_::class];
24+ }
25+
26+ public function refactor (Node $ node ): ?Node
27+ {
28+ return null ;
29+ }
30+ }
You can’t perform that action at this time.
0 commit comments