File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77use PhpParser \Node ;
88use PhpParser \Node \Stmt \Class_ ;
99use Rector \CodeQuality \Rector \Class_ \ConvertStaticToSelfRector ;
10+ use Rector \Exception \ShouldNotHappenException ;
1011use Rector \Rector \AbstractRector ;
1112use Symplify \RuleDocGenerator \ValueObject \CodeSample \CodeSample ;
1213use Symplify \RuleDocGenerator \ValueObject \RuleDefinition ;
1617 */
1718final class ConvertStaticPrivateConstantToSelfRector extends AbstractRector
1819{
19- public function __construct (
20- private readonly ConvertStaticToSelfRector $ convertStaticToSelfRector
21- ) {
22- }
23-
2420 public function getRuleDefinition (): RuleDefinition
2521 {
2622 return new RuleDefinition (
@@ -72,6 +68,10 @@ public function getNodeTypes(): array
7268 */
7369 public function refactor (Node $ node ): ?Class_
7470 {
75- return $ this ->convertStaticToSelfRector ->refactor ($ node );
71+ throw new ShouldNotHappenException (sprintf (
72+ 'The % rule is deprecated. Use %s instead ' ,
73+ self ::class,
74+ ConvertStaticToSelfRector::class,
75+ ));
7676 }
7777}
Original file line number Diff line number Diff line change 66
77use PhpParser \Node ;
88use PhpParser \Node \Stmt \Class_ ;
9+ use Rector \Exception \ShouldNotHappenException ;
910use Rector \Rector \AbstractRector ;
1011use Symplify \RuleDocGenerator \ValueObject \CodeSample \CodeSample ;
1112use Symplify \RuleDocGenerator \ValueObject \RuleDefinition ;
1516 */
1617final class StaticToSelfStaticMethodCallOnFinalClassRector extends AbstractRector
1718{
18- public function __construct (
19- private readonly ConvertStaticToSelfRector $ convertStaticToSelfRector
20- ) {
21- }
22-
2319 public function getRuleDefinition (): RuleDefinition
2420 {
2521 return new RuleDefinition ('Change `static::methodCall()` to `self::methodCall()` on final class ' , [
@@ -70,6 +66,10 @@ public function getNodeTypes(): array
7066 */
7167 public function refactor (Node $ node ): ?Class_
7268 {
73- return $ this ->convertStaticToSelfRector ->refactor ($ node );
69+ throw new ShouldNotHappenException (sprintf (
70+ 'The % rule is deprecated. Use %s instead ' ,
71+ self ::class,
72+ ConvertStaticToSelfRector::class,
73+ ));
7474 }
7575}
You can’t perform that action at this time.
0 commit comments