function ConstExprEvaluator::evaluateDirectly
Directly evaluates a constant expression into a PHP value.
May generate Error exceptions, warnings or notices. Use evaluateSilently() to convert these into a ConstExprEvaluationException.
If some part of the expression cannot be evaluated, the fallback evaluator passed to the constructor will be invoked. By default, if no fallback is provided, an exception of type ConstExprEvaluationException is thrown.
See class doc comment for caveats and limitations.
Parameters
Expr $expr Constant expression to evaluate:
Return value
mixed Result of evaluation
Throws
ConstExprEvaluationException if the expression cannot be evaluated
File
-
vendor/
nikic/ php-parser/ lib/ PhpParser/ ConstExprEvaluator.php, line 101
Class
- ConstExprEvaluator
- Evaluates constant expressions.
Namespace
PhpParserCode
public function evaluateDirectly(Expr $expr) {
return $this->evaluate($expr);
}