report @var changes (#4063)

This commit is contained in:
Tomas Votruba 2020-08-29 20:18:32 +02:00 committed by GitHub
parent 6b39193992
commit 4a2ba04b05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,6 +14,7 @@ use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareVarTagValueNode;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
use Rector\ChangesReporting\Collector\RectorChangeCollector;
use Rector\Core\Configuration\CurrentNodeProvider;
use Rector\Core\Exception\ShouldNotHappenException;
use Rector\NodeTypeResolver\PHPStan\TypeComparator;
use Rector\StaticTypeMapper\StaticTypeMapper;
use Rector\TypeDeclaration\PhpDocParser\ParamPhpDocNodeFactory;
@ -85,8 +86,7 @@ final class PhpDocTypeChanger
}
// notify about node change
$node = $this->currentNodeProvider->getNode();
$this->rectorChangeCollector->notifyNodeFileInfo($node);
$this->notifyChange();
}
public function changeReturnType(PhpDocInfo $phpDocInfo, Type $newType): void
@ -126,4 +126,14 @@ final class PhpDocTypeChanger
$phpDocInfo->addTagValueNode($paramTagValueNode);
}
private function notifyChange(): void
{
$node = $this->currentNodeProvider->getNode();
if ($node === null) {
throw new ShouldNotHappenException();
}
$this->rectorChangeCollector->notifyNodeFileInfo($node);
}
}