add debug notes

This commit is contained in:
TomasVotruba 2020-07-29 03:37:48 +02:00
parent 5859625d5d
commit 9488eb5d07
2 changed files with 7 additions and 7 deletions

View File

@ -113,11 +113,11 @@ PHP
{
$controlTypes = $this->methodNamesByInputNamesResolver->resolveExpr($arrayDimFetch);
if ($controlTypes === []) {
throw new NotImplementedYetException();
throw new NotImplementedYetException($controlName);
}
if (! isset($controlTypes[$controlName])) {
throw new ShouldNotHappenException();
throw new ShouldNotHappenException($controlName);
}
$controlType = $controlTypes[$controlName];

View File

@ -9,7 +9,6 @@ use PhpParser\Node\Expr\ArrayDimFetch;
use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Expr\BinaryOp\Coalesce;
use PhpParser\Node\Expr\Variable;
use PhpParser\Node\Identifier;
use PhpParser\Node\Param;
use PhpParser\Node\Scalar\LNumber;
use PhpParser\Node\Stmt\ClassMethod;
@ -104,7 +103,7 @@ PHP
$secondParam->default = null;
$secondParam->variadic = true;
$secondParam->var = new Identifier('$' . self::PARAMETERS);
$secondParam->var->name = self::PARAMETERS;
return $node;
}
@ -123,16 +122,17 @@ PHP
}
// instantiate
$assign = $this->createCoalesceAssign($paramName, $node);
$assign = $this->createCoalesceAssign($node);
$currentStmt = $node->getAttribute(AttributeKey::CURRENT_STATEMENT);
$this->addNodeBeforeNode($assign, $currentStmt);
$positionNode = $currentStmt ?? $node;
$this->addNodeBeforeNode($assign, $positionNode);
return NodeTraverser::STOP_TRAVERSAL;
});
}
private function createCoalesceAssign(string $paramName, Variable $variable): Assign
private function createCoalesceAssign(Variable $variable): Assign
{
$arrayDimFetch = new ArrayDimFetch(new Variable(self::PARAMETERS), new LNumber(0));
$coalesce = new Coalesce($arrayDimFetch, $this->createNull());