Skip to content

Commit 13f68e5

Browse files
authored
[remove] Remove deprecated FileWithoutNamespace and ScopeResolverNodeVisitorInterface (#7980)
* remove deprecated FileWithoutNamespace * remove deprecated ScopeResolverNodeVisitorInterface * remove releated deprecation files
1 parent adb24d0 commit 13f68e5

10 files changed

Lines changed: 0 additions & 187 deletions

File tree

src/Configuration/RectorConfigBuilder.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
use Rector\Doctrine\Set\DoctrineSetList;
2727
use Rector\Enum\Config\Defaults;
2828
use Rector\Exception\Configuration\InvalidConfigurationException;
29-
use Rector\NodeTypeResolver\PHPStan\Scope\Contract\NodeVisitor\ScopeResolverNodeVisitorInterface;
3029
use Rector\Php\PhpVersionResolver\ComposerJsonPhpVersionResolver;
3130
use Rector\Php80\Rector\Class_\AnnotationToAttributeRector;
3231
use Rector\Php80\ValueObject\AnnotationToAttribute;
@@ -1240,11 +1239,6 @@ public function withTreatClassesAsFinal(bool $isTreatClassesAsFinal = true): sel
12401239

12411240
public function registerService(string $className, ?string $alias = null, ?string $tag = null): self
12421241
{
1243-
// BC layer since 2.2.9
1244-
if ($tag === ScopeResolverNodeVisitorInterface::class) {
1245-
$tag = DecoratingNodeVisitorInterface::class;
1246-
}
1247-
12481242
$this->registerServices[] = new RegisteredService($className, $alias, $tag);
12491243

12501244
return $this;

src/Console/Command/ProcessCommand.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
183183
// 4. Deprecations reporter
184184
$this->deprecatedRulesReporter->reportDeprecatedRules();
185185
$this->deprecatedRulesReporter->reportDeprecatedSkippedRules();
186-
$this->deprecatedRulesReporter->reportDeprecatedNodeTypes();
187186
$this->deprecatedRulesReporter->reportDeprecatedRectorUnsupportedMethods();
188187

189188
$this->missConfigurationReporter->reportSkippedNeverRegisteredRules();

src/NodeTypeResolver/PHPStan/Scope/Contract/NodeVisitor/ScopeResolverNodeVisitorInterface.php

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/PhpParser/Node/CustomNode/FileWithoutNamespace.php

Lines changed: 0 additions & 32 deletions
This file was deleted.

src/PhpParser/NodeTraverser/RectorNodeTraverser.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
use Rector\Configuration\ConfigurationRuleFilter;
1414
use Rector\Contract\Rector\RectorInterface;
1515
use Rector\Exception\ShouldNotHappenException;
16-
use Rector\PhpParser\Node\CustomNode\FileWithoutNamespace;
17-
use Rector\PhpParser\Node\FileNode;
1816
use Rector\VersionBonding\ComposerPackageConstraintFilter;
1917
use Rector\VersionBonding\PhpVersionedFilter;
2018
use Webmozart\Assert\Assert;
@@ -127,12 +125,6 @@ public function getVisitorsForNode(Node $node): array
127125
/** @var RectorInterface $visitor */
128126
foreach ($this->visitors as $visitor) {
129127
foreach ($visitor->getNodeTypes() as $nodeType) {
130-
// BC layer matching
131-
if ($nodeType === FileWithoutNamespace::class && $nodeClass === FileNode::class) {
132-
$this->visitorsPerNodeClass[$nodeClass][] = $visitor;
133-
continue;
134-
}
135-
136128
if (is_a($nodeClass, $nodeType, true)) {
137129
$this->visitorsPerNodeClass[$nodeClass][] = $visitor;
138130
continue 2;

src/Reporting/DeprecatedRulesReporter.php

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use Rector\Configuration\Option;
99
use Rector\Configuration\Parameter\SimpleParameterProvider;
1010
use Rector\Contract\Rector\RectorInterface;
11-
use Rector\PhpParser\Node\CustomNode\FileWithoutNamespace;
1211
use Rector\PhpParser\Node\FileNode;
1312
use ReflectionMethod;
1413
use Symfony\Component\Console\Style\SymfonyStyle;
@@ -75,36 +74,4 @@ public function reportDeprecatedRectorUnsupportedMethods(): void
7574
}
7675
}
7776
}
78-
79-
public function reportDeprecatedNodeTypes(): void
80-
{
81-
// helper property to avoid reporting multiple times
82-
static $reportedClasses = [];
83-
84-
foreach ($this->rectors as $rector) {
85-
if (in_array(FileWithoutNamespace::class, $rector->getNodeTypes(), true)) {
86-
$this->reportDeprecatedFileWithoutNamespace($rector);
87-
continue;
88-
}
89-
90-
// already reported, skip
91-
if (in_array($rector::class, $reportedClasses, true)) {
92-
continue;
93-
}
94-
95-
$reportedClasses[] = $rector::class;
96-
}
97-
}
98-
99-
private function reportDeprecatedFileWithoutNamespace(RectorInterface $rector): void
100-
{
101-
$this->symfonyStyle->warning(sprintf(
102-
'Node type "%s" is deprecated and will be removed. Use "%s" in the "%s" rule instead instead.%sSee %s for upgrade path',
103-
FileWithoutNamespace::class,
104-
FileNode::class,
105-
$rector::class,
106-
PHP_EOL . PHP_EOL,
107-
'https://github.com/rectorphp/rector-src/blob/main/UPGRADING.md'
108-
));
109-
}
11077
}

tests/Issues/FileWithoutNamespaceCompat/FileWithoutNamespaceCompatTest.php

Lines changed: 0 additions & 28 deletions
This file was deleted.

tests/Issues/FileWithoutNamespaceCompat/Fixture/namespace_less_file.php.inc

Lines changed: 0 additions & 16 deletions
This file was deleted.

tests/Issues/FileWithoutNamespaceCompat/Rector/SubscribedToFileWithoutNamespaceRector.php

Lines changed: 0 additions & 40 deletions
This file was deleted.

tests/Issues/FileWithoutNamespaceCompat/config/configured_rule.php

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)