Skip to content

Commit

Permalink
remove downgrade only method
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Jan 15, 2023
1 parent 7ab50dc commit 8bf0045
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions rules/CodeQuality/NodeFactory/PropertyTypeDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,15 @@

namespace Rector\CodeQuality\NodeFactory;

use PhpParser\Node\ComplexType;
use PhpParser\Node\Identifier;
use PhpParser\Node\Name;
use PhpParser\Node\Stmt\Property;
use PHPStan\Type\Type;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger;
use Rector\Privatization\TypeManipulator\TypeNormalizer;
use Rector\StaticTypeMapper\StaticTypeMapper;

final class PropertyTypeDecorator
{
public function __construct(
private readonly StaticTypeMapper $staticTypeMapper,
private readonly PhpDocTypeChanger $phpDocTypeChanger,
private readonly PhpDocInfoFactory $phpDocInfoFactory,
private readonly TypeNormalizer $typeNormalizer
Expand All @@ -34,18 +29,4 @@ public function decorateProperty(Property $property, Type $propertyType): void

$this->phpDocTypeChanger->changeVarType($phpDocInfo, $propertyType);
}

/**
* @api downgrade
*/
public function decoratePropertyWithDocBlock(Property $property, ComplexType|Identifier|Name $typeNode): void
{
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($property);
if ($phpDocInfo->getVarTagValueNode() !== null) {
return;
}

$newType = $this->staticTypeMapper->mapPhpParserNodePHPStanType($typeNode);
$this->phpDocTypeChanger->changeVarType($phpDocInfo, $newType);
}
}

0 comments on commit 8bf0045

Please sign in to comment.