mirror of
https://github.com/danog/psalm.git
synced 2024-12-15 19:07:00 +01:00
ffe7874906
* extract the operation out of the loop when possible * remove unnecessary interfaces when already inherited in parent * simplify expressions * avoid using alias functions * redundant phpdoc * unused imports
27 lines
552 B
PHP
27 lines
552 B
PHP
<?php
|
|
namespace Psalm\Internal\PhpVisitor;
|
|
|
|
use PhpParser;
|
|
|
|
/**
|
|
* @internal
|
|
*/
|
|
class NodeCleanerVisitor extends PhpParser\NodeVisitorAbstract
|
|
{
|
|
private $type_provider;
|
|
|
|
public function __construct(\Psalm\Internal\Provider\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;
|
|
}
|
|
}
|