Skip to content

Commit

Permalink
[DX] Remove DependencyClassMethodDecorator as not used anymore due to…
Browse files Browse the repository at this point in the history
… paralel nature (#5094)
  • Loading branch information
TomasVotruba committed Sep 30, 2023
1 parent 6ce58b1 commit 3c1035b
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 291 deletions.
3 changes: 3 additions & 0 deletions packages/NodeNameResolver/NodeNameResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ public function getName(Node | string $node): ?string
return (string) $node->name;
}

/**
* @api
*/
public function areNamesEqual(Node $firstNode, Node $secondNode): bool
{
$secondResolvedName = $this->getName($secondNode);
Expand Down
3 changes: 0 additions & 3 deletions src/Configuration/RenamedClassesDataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ final class RenamedClassesDataCollector implements ResetableInterface
*/
private array $oldToNewClasses = [];

/**
* @api for fast tests with single container
*/
public function reset(): void
{
$this->oldToNewClasses = [];
Expand Down
14 changes: 0 additions & 14 deletions src/Exception/DeprecatedException.php

This file was deleted.

26 changes: 0 additions & 26 deletions src/NodeAnalyzer/PromotedPropertyParamCleaner.php

This file was deleted.

22 changes: 0 additions & 22 deletions src/NodeManipulator/ClassDependencyManipulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,16 @@
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Expression;
use PhpParser\Node\Stmt\Property;
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Type\Type;
use Rector\Core\Enum\ObjectReference;
use Rector\Core\NodeAnalyzer\PropertyPresenceChecker;
use Rector\Core\NodeManipulator\Dependency\DependencyClassMethodDecorator;
use Rector\Core\Php\PhpVersionProvider;
use Rector\Core\PhpParser\Node\NodeFactory;
use Rector\Core\Reflection\ReflectionResolver;
use Rector\Core\ValueObject\MethodName;
use Rector\Core\ValueObject\PhpVersionFeature;
use Rector\NodeNameResolver\NodeNameResolver;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\PostRector\ValueObject\PropertyMetadata;
use Rector\TypeDeclaration\NodeAnalyzer\AutowiredClassMethodOrPropertyAnalyzer;

Expand All @@ -39,7 +36,6 @@ public function __construct(
private readonly PropertyPresenceChecker $propertyPresenceChecker,
private readonly NodeNameResolver $nodeNameResolver,
private readonly AutowiredClassMethodOrPropertyAnalyzer $autowiredClassMethodOrPropertyAnalyzer,
private readonly DependencyClassMethodDecorator $dependencyClassMethodDecorator,
private readonly ReflectionResolver $reflectionResolver
) {
}
Expand Down Expand Up @@ -98,15 +94,6 @@ public function addConstructorDependencyWithCustomAssign(

$this->classMethodAssignManipulator->addParameterAndAssignToMethod($constructorMethod, $name, $type, $assign);
$this->classInsertManipulator->addAsFirstMethod($class, $constructorMethod);

/** @var Scope $scope */
$scope = $class->getAttribute(AttributeKey::SCOPE);

$this->dependencyClassMethodDecorator->decorateConstructorWithParentDependencies(
$class,
$constructorMethod,
$scope
);
}

/**
Expand Down Expand Up @@ -157,15 +144,6 @@ private function addPromotedProperty(Class_ $class, PropertyMetadata $propertyMe
$constructClassMethod = $this->nodeFactory->createPublicMethod(MethodName::CONSTRUCT);
$constructClassMethod->params[] = $param;
$this->classInsertManipulator->addAsFirstMethod($class, $constructClassMethod);

/** @var Scope $scope */
$scope = $class->getAttribute(AttributeKey::SCOPE);

$this->dependencyClassMethodDecorator->decorateConstructorWithParentDependencies(
$class,
$constructClassMethod,
$scope
);
}
}

Expand Down
213 changes: 0 additions & 213 deletions src/NodeManipulator/Dependency/DependencyClassMethodDecorator.php

This file was deleted.

13 changes: 0 additions & 13 deletions src/PhpParser/Node/NodeFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
use Rector\Core\Exception\NotImplementedYetException;
use Rector\Core\Exception\ShouldNotHappenException;
use Rector\Core\NodeDecorator\PropertyTypeDecorator;
use Rector\Core\ValueObject\MethodName;
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
use Rector\PostRector\ValueObject\PropertyMetadata;
use Rector\StaticTypeMapper\StaticTypeMapper;
Expand Down Expand Up @@ -197,18 +196,6 @@ public function createPropertyFetch(string | Expr $variableNameOrExpr, string $p
return $this->builderFactory->propertyFetch($fetcherExpr, $property);
}

/**
* @param Param[] $params
*/
public function createParentConstructWithParams(array $params): StaticCall
{
return new StaticCall(
new Name(ObjectReference::PARENT),
new Identifier(MethodName::CONSTRUCT),
$this->createArgsFromParams($params)
);
}

/**
* @api doctrine
*/
Expand Down

0 comments on commit 3c1035b

Please sign in to comment.