1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 12:55:26 +01:00

Get rid of var_dumps

This commit is contained in:
Matthew Brown 2016-11-05 20:53:39 -04:00
parent 7d6ac4719f
commit 721e0d01e2
4 changed files with 34 additions and 4 deletions

View File

@ -18,6 +18,7 @@ use Psalm\Issue\ForbiddenCode;
use Psalm\Issue\InvalidStaticVariable;
use Psalm\Issue\PossiblyUndefinedVariable;
use Psalm\Issue\UndefinedVariable;
use Psalm\Issue\UnrecognizedExpression;
use Psalm\IssueBuffer;
use Psalm\Type;
@ -366,8 +367,16 @@ class ExpressionChecker
} elseif ($stmt instanceof PhpParser\Node\Expr\YieldFrom) {
self::checkYieldFrom($statements_checker, $stmt, $context);
} else {
var_dump('Unrecognised expression in ' . $statements_checker->getCheckedFileName());
var_dump($stmt);
if (IssueBuffer::accepts(
new UnrecognizedExpression(
'Psalm does not understand ' . get_class($stmt),
$statements_checker->getCheckedFileName(),
$stmt->getLine()
),
$statements_checker->getSuppressedIssues()
)) {
return false;
}
}
foreach (Config::getInstance()->getPlugins() as $plugin) {

View File

@ -15,6 +15,7 @@ use Psalm\Context;
use Psalm\Issue\ContinueOutsideLoop;
use Psalm\Issue\InvalidGlobal;
use Psalm\Issue\InvalidNamespace;
use Psalm\Issue\UnrecognizedStatement;
use Psalm\IssueBuffer;
use Psalm\StatementsSource;
use Psalm\Type;
@ -318,8 +319,16 @@ class StatementsChecker
$namespace_checker = new NamespaceChecker($stmt, $this->source);
$namespace_checker->check(true);
} else {
var_dump('Unrecognised statement in ' . $this->checked_file_name);
var_dump($stmt);
if (IssueBuffer::accepts(
new UnrecognizedStatement(
'Psalm does not understand ' . get_class($stmt),
$this->getCheckedFileName(),
$stmt->getLine()
),
$this->getSuppressedIssues()
)) {
return false;
}
}
}

View File

@ -0,0 +1,6 @@
<?php
namespace Psalm\Issue;
class UnrecognizedExpression extends CodeError
{
}

View File

@ -0,0 +1,6 @@
<?php
namespace Psalm\Issue;
class UnrecognizedStatement extends CodeError
{
}