Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core] AbstractScopeAwareRector is ready to be used in custom rules 🎉 🎉 🎉 #2537

Merged
merged 1 commit into from
Jun 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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