1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-15 19:07:00 +01:00
psalm/src/Psalm/Internal/PhpVisitor/NodeCleanerVisitor.php

29 lines
574 B
PHP
Raw Normal View History

<?php
2020-03-15 04:54:42 +01:00
namespace Psalm\Internal\PhpVisitor;
use PhpParser;
2021-12-03 20:11:20 +01:00
use Psalm\Internal\Provider\NodeDataProvider;
/**
* @internal
*/
class NodeCleanerVisitor extends PhpParser\NodeVisitorAbstract
{
private $type_provider;
2021-12-03 20:11:20 +01:00
public function __construct(NodeDataProvider $type_provider)
{
$this->type_provider = $type_provider;
}
public function enterNode(PhpParser\Node $node): ?int
{
if ($node instanceof PhpParser\Node\Expr) {
$this->type_provider->clearNodeOfTypeAndAssertions($node);
}
return null;
}
}