Methods |
public
|
__construct(callable|null $fallbackEvaluator = null)
Create a constant expression evaluator. The provided fallback evaluator is invoked whenever a subexpression cannot be evaluated. See
class doc comment for more information.
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
$fallbackEvaluator |
To call if subexpression cannot be evaluated
|
|
#
|
public
|
evaluateSilently(Expr $expr): mixed
Silently evaluates a constant expression into a PHP value. Thrown Errors, warnings or notices will be converted into a ConstExprEvaluationException.
The original source of the exception is available through getPrevious(). 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.
Silently evaluates a constant expression into a PHP value. Thrown Errors, warnings or notices will be converted into a ConstExprEvaluationException.
The original source of the exception is available through getPrevious(). 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 |
Constant expression to evaluate
|
Returns
Throws
|
#
|
public
|
evaluateDirectly(Expr $expr): mixed
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.
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 |
Constant expression to evaluate
|
Returns
Throws
|
#
|