Skip to content

Commit

Permalink
[cleanup] Remove deprecated NonPhpRectorInterface, PseudoNamespaceToN…
Browse files Browse the repository at this point in the history
…amespaceRector and mysql to mysqli sets (#4927)
  • Loading branch information
TomasVotruba committed Sep 6, 2023
1 parent d3719c2 commit 10eb09f
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 173 deletions.
9 changes: 0 additions & 9 deletions config/set/mysql-to-mysqli.php

This file was deleted.

22 changes: 2 additions & 20 deletions packages/Config/RectorConfig.php
Expand Up @@ -9,7 +9,6 @@
use Rector\Core\Configuration\Option;
use Rector\Core\Configuration\Parameter\SimpleParameterProvider;
use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
use Rector\Core\Contract\Rector\NonPhpRectorInterface;
use Rector\Core\Contract\Rector\RectorInterface;
use Rector\Core\Exception\ShouldNotHappenException;
use Rector\Core\FileSystem\FilesystemTweaker;
Expand Down Expand Up @@ -178,7 +177,7 @@ public function ruleWithConfiguration(string $rectorClass, array $configuration)
);

$this->singleton($rectorClass);
$this->tagRectorService($rectorClass);
$this->tag($rectorClass, RectorInterface::class);

$this->afterResolving($rectorClass, function (ConfigurableRectorInterface $configurableRector) use (
$rectorClass
Expand All @@ -200,7 +199,7 @@ public function rule(string $rectorClass): void
Assert::isAOf($rectorClass, RectorInterface::class);

$this->singleton($rectorClass);
$this->tagRectorService($rectorClass);
$this->tag($rectorClass, RectorInterface::class);

if (is_a($rectorClass, AbstractScopeAwareRector::class, true)) {
$this->extend(
Expand Down Expand Up @@ -389,23 +388,6 @@ private function resolveDuplicatedValues(array $values): array
return array_unique($duplicates);
}

/**
* @param class-string<RectorInterface> $rectorClass
*/
private function tagRectorService(string $rectorClass): void
{
$this->tag($rectorClass, RectorInterface::class);

if (is_a($rectorClass, NonPhpRectorInterface::class, true)) {
trigger_error(sprintf(
'The "%s" interface of "%s" rule is deprecated. Rector will process only PHP code, as designed to with AST. For another file format, use custom tooling.',
NonPhpRectorInterface::class,
$rectorClass,
));
exit();
}
}

/**
* @param string[] $rectorClasses
*/
Expand Down
6 changes: 0 additions & 6 deletions packages/Set/ValueObject/SetList.php
Expand Up @@ -36,12 +36,6 @@ final class SetList implements SetListInterface
*/
public const GMAGICK_TO_IMAGICK = __DIR__ . '/../../../config/set/gmagick-to-imagick.php';

/**
* @deprecated Handle manually with explicit refactoring instead.
* @var string
*/
public const MYSQL_TO_MYSQLI = __DIR__ . '/../../../config/set/mysql-to-mysqli.php';

/**
* @var string
*/
Expand Down
7 changes: 0 additions & 7 deletions phpstan.neon
Expand Up @@ -576,8 +576,6 @@ parameters:
message: '#Public method "Rector\\Core\\DependencyInjection\\RectorContainerFactory\:\:createFromBootstrapConfigs\(\)" is never used#'
path: src/DependencyInjection/RectorContainerFactory.php

- '#Class "Rector\\Renaming\\Rector\\FileWithoutNamespace\\PseudoNamespaceToNamespaceRector" is missing @see annotation with test case class reference#'

# chicken/egg
-
message: '#Function "(d|dd)\(\)" cannot be used/left in the code#'
Expand All @@ -592,11 +590,6 @@ parameters:
message: '#Do not name "d", shorter than 2 chars#'
path: tests/debug_functions.php

# deprecated
-
message: '#Fetching class constant class of deprecated class Rector\\Core\\Contract\\Rector\\NonPhpRectorInterface#'
path: packages/Config/*

# method signature kept for symmetry of hasParentClassMethod() with getParentClassMethod()
-
message: '#Parameters should use "PhpParser\\Node\\Stmt\\ClassMethod" types as the only types passed to this method#'
Expand Down

This file was deleted.

33 changes: 0 additions & 33 deletions rules/Renaming/ValueObject/PseudoNamespaceToNamespace.php

This file was deleted.

13 changes: 0 additions & 13 deletions src/Contract/Rector/NonPhpRectorInterface.php

This file was deleted.

2 changes: 0 additions & 2 deletions src/DependencyInjection/LazyContainerFactory.php
Expand Up @@ -710,10 +710,8 @@ static function (
ScopeResolverNodeVisitorInterface::class
);

// phpstan factory
$this->createPHPStanServices($rectorConfig);

// @todo add base node visitors
$rectorConfig->when(PhpDocNodeMapper::class)
->needs('$phpDocNodeVisitors')
->giveTagged(BasePhpDocNodeVisitorInterface::class);
Expand Down
10 changes: 0 additions & 10 deletions src/NodeManipulator/IfManipulator.php
Expand Up @@ -186,16 +186,6 @@ public function isIfWithoutElseAndElseIfs(If_ $if): bool
return $if->elseifs === [];
}

/**
* @deprecated Create If_ directly, this is simple new with no added value
*/
public function createIfStmt(Expr $condExpr, Stmt $stmt): If_
{
return new If_($condExpr, [
'stmts' => [$stmt],
]);
}

private function matchComparedAndReturnedNode(NotIdentical $notIdentical, Return_ $return): ?Expr
{
if ($this->nodeComparator->areNodesEqual(
Expand Down

0 comments on commit 10eb09f

Please sign in to comment.