Skip to content

Commit cdb0ea6

Browse files
committed
add deprecation reference to NarrowTooWideReturnTypeRector
1 parent 1dfe1b2 commit cdb0ea6

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
}

0 commit comments

Comments
 (0)