Browse Source

Allow expression evaluator to return an array if stack contains multiple values

master
Adam Pippin 3 years ago
parent
commit
a2d5324840
  1. 4
      app/Engine/Cfnpp/Expression/Expression.php

4
app/Engine/Cfnpp/Expression/Expression.php

@ -43,7 +43,7 @@ class Expression
* Evaluate the tokens contained in this expression. * Evaluate the tokens contained in this expression.
* *
* @param array<string,mixed> $variables variables that can be referenced * @param array<string,mixed> $variables variables that can be referenced
* @return mixed * @return mixed if expression evaluated down to a single value a scalar, otherwise an array
*/ */
public function evaluate(array $variables = []) public function evaluate(array $variables = [])
{ {
@ -83,7 +83,7 @@ class Expression
return end($this->stack); return end($this->stack);
} }
throw new \Exception('Expression did not evaluate down to a single value'); return $this->stack;
} }
/** /**

Loading…
Cancel
Save