mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-07 03:40:50 +00:00
727b9f46f0
bfa1891c50
[cleanup] Remove 73 unused public methods (#3245)
39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare (strict_types=1);
|
|
namespace Rector\BetterPhpDocParser\PhpDocManipulator;
|
|
|
|
use PhpParser\Node;
|
|
use PHPStan\Type\MixedType;
|
|
use PHPStan\Type\Type;
|
|
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
|
|
final class VarAnnotationManipulator
|
|
{
|
|
/**
|
|
* @readonly
|
|
* @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory
|
|
*/
|
|
private $phpDocInfoFactory;
|
|
/**
|
|
* @readonly
|
|
* @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger
|
|
*/
|
|
private $phpDocTypeChanger;
|
|
public function __construct(PhpDocInfoFactory $phpDocInfoFactory, \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger $phpDocTypeChanger)
|
|
{
|
|
$this->phpDocInfoFactory = $phpDocInfoFactory;
|
|
$this->phpDocTypeChanger = $phpDocTypeChanger;
|
|
}
|
|
/**
|
|
* @api
|
|
*/
|
|
public function decorateNodeWithType(Node $node, Type $staticType) : void
|
|
{
|
|
if ($staticType instanceof MixedType) {
|
|
return;
|
|
}
|
|
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node);
|
|
$this->phpDocTypeChanger->changeVarType($phpDocInfo, $staticType);
|
|
}
|
|
}
|