Skip to content

Commit 5f03843

Browse files
committed
just throw
1 parent 8c9a269 commit 5f03843

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

src/Rector/AbstractScopeAwareRector.php

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
namespace Rector\Rector;
66

77
use PhpParser\Node;
8-
use PhpParser\NodeTraverser;
98
use Rector\Contract\Rector\ScopeAwareRectorInterface;
10-
use Rector\NodeTypeResolver\Node\AttributeKey;
9+
use Rector\Exception\ShouldNotHappenException;
1110

1211
/**
1312
* @deprecated This class is deprecated, as too granular.
@@ -21,18 +20,9 @@ abstract class AbstractScopeAwareRector extends AbstractRector implements ScopeA
2120
*/
2221
public function refactor(Node $node): int|array|Node|null
2322
{
24-
trigger_error(
25-
sprintf(
26-
'The `Rector\Rector\AbstractScopeAwareRector` is removed, use `Rector\Rector\AbstractRector` with `ScopeFetcher::fetch($node)` instead, see upgrading guide %s',
27-
'https://github.com/rectorphp/rector-src/blob/main/UPGRADING.md#1-abstractscopeawarerector-is-removed-use-abstractrector-instead',
28-
),
29-
E_USER_DEPRECATED
30-
);
31-
32-
$currentScope = $node->getAttribute(AttributeKey::SCOPE);
33-
34-
// method called needs to trigger exception above
35-
// as refactor() is called via refactorWithScope()
36-
return $this->refactorWithScope($node, $currentScope);
23+
throw new ShouldNotHappenException(sprintf(
24+
'The `Rector\Rector\AbstractScopeAwareRector` is removed, use `Rector\Rector\AbstractScopeAwareRector` instead, see upgrading guide %s',
25+
'https://github.com/rectorphp/rector-src/blob/main/UPGRADING.md#1-abstractscopeawarerector-is-removed-use-abstractrector-instead',
26+
));
3727
}
3828
}

0 commit comments

Comments
 (0)