File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
rules/DeadCode/Rector/FunctionLike Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Rector \DeadCode \Rector \FunctionLike ;
4+
5+ use PhpParser \Node ;
6+ use PhpParser \Node \Stmt \ClassMethod ;
7+ use Rector \Configuration \Deprecation \Contract \DeprecatedInterface ;
8+ use Rector \Exception \ShouldNotHappenException ;
9+ use Rector \Rector \AbstractRector ;
10+ use Symplify \RuleDocGenerator \ValueObject \RuleDefinition ;
11+
12+ /**
13+ * @deprecated as renamed to \Rector\DeadCode\Rector\FunctionLike\NarrowWideUnionReturnTypeRector
14+ */
15+ final class NarrowTooWideReturnTypeRector extends AbstractRector implements DeprecatedInterface
16+ {
17+ public function getRuleDefinition (): RuleDefinition
18+ {
19+ return new RuleDefinition ('Deprecated ' , []);
20+ }
21+
22+ public function getNodeTypes (): array
23+ {
24+ return [ClassMethod::class];
25+ }
26+
27+ public function refactor (Node $ node )
28+ {
29+ throw new ShouldNotHappenException (sprintf (
30+ 'Class "%s" is deprecated and renamed to "%s". Use the new class instead. ' ,
31+ self ::class,
32+ NarrowWideUnionReturnTypeRector::class
33+ ));
34+ }
35+ }
You can’t perform that action at this time.
0 commit comments