function ConstExprEvaluator::__construct
Create a constant expression evaluator.
The provided fallback evaluator is invoked whenever a subexpression cannot be evaluated. See class doc comment for more information.
Parameters
callable|null $fallbackEvaluator To call if subexpression cannot be evaluated:
File
-
vendor/
nikic/ php-parser/ lib/ PhpParser/ ConstExprEvaluator.php, line 41
Class
- ConstExprEvaluator
- Evaluates constant expressions.
Namespace
PhpParserCode
public function __construct(?callable $fallbackEvaluator = null) {
$this->fallbackEvaluator = $fallbackEvaluator ?? function (Expr $expr) {
throw new ConstExprEvaluationException("Expression of type {$expr->getType()} cannot be evaluated");
};
}