Skip to content

Commit

Permalink
[Core] AbstractScopeAwareRector is ready to be used in custom rules (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Jun 20, 2022
1 parent f4a9b50 commit 21fc218
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
7 changes: 1 addition & 6 deletions rules/Php70/Rector/FuncCall/MultiDirnameRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function refactor(Node $node): ?Node
}

// nothing to improve
if ($this->shouldSkip()) {
if ($this->nestingLevel < 2) {
return null;
}

Expand All @@ -76,11 +76,6 @@ public function provideMinPhpVersion(): int
return PhpVersionFeature::DIRNAME_LEVELS;
}

private function shouldSkip(): bool
{
return $this->nestingLevel < 2;
}

private function matchNestedDirnameFuncCall(FuncCall $funcCall): ?FuncCall
{
if (! $this->isName($funcCall, self::DIRNAME)) {
Expand Down
4 changes: 0 additions & 4 deletions src/Rector/AbstractScopeAwareRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
use Rector\Core\Exception\ShouldNotHappenException;
use Rector\NodeTypeResolver\Node\AttributeKey;

/**
* @internal Currently in experimental testing for core Rector rules. So we can verify if this feature is useful or not.
* Do not use outside in custom rules. Go for AbstractRector instead.
*/
abstract class AbstractScopeAwareRector extends AbstractRector implements ScopeAwarePhpRectorInterface
{
/**
Expand Down

0 comments on commit 21fc218

Please sign in to comment.