Skip to content
27 changes: 0 additions & 27 deletions src/Config/RectorConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
namespace Rector\Config;

use Composer\Semver\Semver;
use Deprecated;
use Entropy\Container\Container;
use Rector\Caching\Contract\ValueObject\Storage\CacheStorageInterface;
use Rector\Composer\InstalledPackageResolver;
use Rector\Configuration\Option;
use Rector\Configuration\Parameter\SimpleParameterProvider;
Expand Down Expand Up @@ -460,31 +458,6 @@ public function containerCacheDirectory(string $directoryPath): void
SimpleParameterProvider::setParameter(Option::CONTAINER_CACHE_DIRECTORY, $directoryPath);
}

/**
* @param class-string<CacheStorageInterface> $cacheClass
*/
#[Deprecated(message: <<<'TXT'
Cache storage is selected automatically: file cache locally, in-memory cache in CI,
where the ephemeral workspace makes writing a cache that is never re-read wasted IO.
The passed value is ignored.
TXT)]
public function cacheClass(string $cacheClass): void
{
Assert::isAOf($cacheClass, CacheStorageInterface::class);
}

/**
* @param class-string $cacheMetaExtensionClass
*/
#[Deprecated(message: <<<'TXT'
Niche mechanism, no longer applied. Let Rector handle cache on its own. If custom
invalidation is needed, handle it in CI in a more generic way, e.g. by clearing the cache directory.
TXT)]
public function cacheMetaExtension(string $cacheMetaExtensionClass): void
{
SimpleParameterProvider::addParameter(Option::CACHE_META_EXTENSIONS, $cacheMetaExtensionClass);
}

/**
* @see https://github.com/nikic/PHP-Parser/issues/723#issuecomment-712401963
*/
Expand Down
77 changes: 0 additions & 77 deletions src/Configuration/RectorConfigBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Rector\Configuration;

use Deprecated;
use DrupalRector\Set\DrupalSetList;
use Nette\Utils\Strings;
use PhpParser\NodeVisitor;
Expand Down Expand Up @@ -583,60 +582,6 @@ public function withPhpSets(
return $this->addPhpLevelSets($pickedPhpVersions[0]);
}

#[Deprecated(message: 'Use "withPhpLevel()" instead, it raises PHP level one rule at a time.')]
public function withPhp53Sets(): self
{
return $this->reportDeprecatedPhpSetsMethod(__FUNCTION__);
}

#[Deprecated(message: 'Use "withPhpLevel()" instead, it raises PHP level one rule at a time.')]
public function withPhp54Sets(): self
{
return $this->reportDeprecatedPhpSetsMethod(__FUNCTION__);
}

#[Deprecated(message: 'Use "withPhpLevel()" instead, it raises PHP level one rule at a time.')]
public function withPhp55Sets(): self
{
return $this->reportDeprecatedPhpSetsMethod(__FUNCTION__);
}

#[Deprecated(message: 'Use "withPhpLevel()" instead, it raises PHP level one rule at a time.')]
public function withPhp56Sets(): self
{
return $this->reportDeprecatedPhpSetsMethod(__FUNCTION__);
}

#[Deprecated(message: 'Use "withPhpLevel()" instead, it raises PHP level one rule at a time.')]
public function withPhp70Sets(): self
{
return $this->reportDeprecatedPhpSetsMethod(__FUNCTION__);
}

#[Deprecated(message: 'Use "withPhpLevel()" instead, it raises PHP level one rule at a time.')]
public function withPhp71Sets(): self
{
return $this->reportDeprecatedPhpSetsMethod(__FUNCTION__);
}

#[Deprecated(message: 'Use "withPhpLevel()" instead, it raises PHP level one rule at a time.')]
public function withPhp72Sets(): self
{
return $this->reportDeprecatedPhpSetsMethod(__FUNCTION__);
}

#[Deprecated(message: 'Use "withPhpLevel()" instead, it raises PHP level one rule at a time.')]
public function withPhp73Sets(): self
{
return $this->reportDeprecatedPhpSetsMethod(__FUNCTION__);
}

#[Deprecated(message: 'Use "withPhpLevel()" instead, it raises PHP level one rule at a time.')]
public function withPhp74Sets(): self
{
return $this->reportDeprecatedPhpSetsMethod(__FUNCTION__);
}

// there is no withPhp80Sets() and above,
// as we already use PHP 8.0 and should go with withPhpSets() instead

Expand Down Expand Up @@ -796,21 +741,6 @@ public function withCache(
return $this;
}

/**
* @param class-string $cacheMetaExtensionClass
* @deprecated Niche mechanism, no longer applied. Let Rector handle cache on its own.
*/
#[Deprecated(message: <<<'TXT'
Niche mechanism, no longer applied. Let Rector handle cache on its own. If custom
invalidation is needed, handle it in CI in a more generic way, e.g. by clearing the cache directory.
TXT)]
public function withCacheMetaExtension(string $cacheMetaExtensionClass): self
{
SimpleParameterProvider::addParameter(Option::CACHE_META_EXTENSIONS, $cacheMetaExtensionClass);

return $this;
}

/**
* @param class-string<ConfigurableRectorInterface> $rectorClass
* @param mixed[] $configuration
Expand Down Expand Up @@ -1180,13 +1110,6 @@ private function addPhpLevelSets(int $phpVersion): self
return $this;
}

private function reportDeprecatedPhpSetsMethod(string $methodName): self
{
SimpleParameterProvider::addParameter(Option::DEPRECATED_PHP_SETS_METHODS, $methodName);

return $this;
}

/**
* @param array<class-string<RectorInterface>> $availableRules
*/
Expand Down
4 changes: 3 additions & 1 deletion src/NodeAnalyzer/ScopeAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@

use PhpParser\Node;
use PhpParser\Node\ComplexType;
use PhpParser\Node\Expr\BinaryOp\Spaceship;
use PhpParser\Node\Identifier;
use PhpParser\Node\Name;
use PhpParser\Node\Stmt\Break_;

final class ScopeAnalyzer
{
/**
* @var array<class-string<Node>>
*/
private const array NON_REFRESHABLE_NODES = [Name::class, Identifier::class, ComplexType::class];
private const array NON_REFRESHABLE_NODES = [Name::class, Identifier::class, ComplexType::class, Break_::class, Spaceship::class];

public function isRefreshable(Node $node): bool
{
Expand Down
5 changes: 0 additions & 5 deletions src/NodeTypeResolver/Node/AttributeKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,6 @@ final class AttributeKey

public const string IS_REGULAR_PATTERN = 'is_regular_pattern';

/**
* Helps with infinite loop detection
*/
public const string CREATED_BY_RULE = 'created_by_rule';

public const string WRAPPED_IN_PARENTHESES = 'wrapped_in_parentheses';

/**
Expand Down
11 changes: 4 additions & 7 deletions src/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\PhpParser\Node\FileNode;
use Rector\Util\Reflection\PrivatesAccessor;
use Webmozart\Assert\Assert;

/**
* @inspired by https://github.com/silverstripe/silverstripe-upgrader/blob/532182b23e854d02e0b27e68ebc394f436de0682/src/UpgradeRule/PHP/Visitor/PHPStanScopeVisitor.php
Expand Down Expand Up @@ -446,8 +445,6 @@ private function nodeScopeResolverProcessNodes(
MutatingScope $mutatingScope,
callable $nodeCallback
): void {
Assert::allIsInstanceOf($stmts, Stmt::class);

try {
$this->nodeScopeResolver->processNodes($stmts, $mutatingScope, $nodeCallback);
} catch (ParserErrorsException|ParserException|ShouldNotHappenException|UndefinedVariableException) {
Expand All @@ -460,6 +457,10 @@ private function nodeScopeResolverProcessNodes(

private function processCallLike(CallLike $callLike, MutatingScope $mutatingScope): void
{
if ($callLike->isFirstClassCallable()) {
return;
}

if ($callLike instanceof StaticCall) {
$callLike->class->setAttribute(AttributeKey::SCOPE, $mutatingScope);
$callLike->name->setAttribute(AttributeKey::SCOPE, $mutatingScope);
Expand All @@ -472,10 +473,6 @@ private function processCallLike(CallLike $callLike, MutatingScope $mutatingScop
$callLike->class->setAttribute(AttributeKey::SCOPE, $mutatingScope);
}

if ($callLike->isFirstClassCallable()) {
return;
}

foreach ($callLike->getArgs() as $arg) {
$arg->value->setAttribute(AttributeKey::SCOPE, $mutatingScope);
}
Expand Down
Loading
Loading