Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ConstExprEvaluator.php

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

PhpParser

Code

public function evaluateDirectly(Expr $expr) {
    return $this->evaluate($expr);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal