Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Component/Assertion/Handle.php \Drupal\Component\Assertion\Handle::register()
  2. 9 core/lib/Drupal/Component/Assertion/Handle.php \Drupal\Component\Assertion\Handle::register()

Ensures exceptions are thrown when an assertion fails.

File

core/lib/Drupal/Component/Assertion/Handle.php, line 22

Class

Handle
Handler for runtime assertion failures.

Namespace

Drupal\Component\Assertion

Code

public static function register() {

  // Since we're using exceptions, turn error warnings off.
  // phpcs:ignore Generic.PHP.DeprecatedFunctions.Deprecated
  assert_options(ASSERT_WARNING, FALSE);

  // Turn exception throwing on.
  // phpcs:ignore Generic.PHP.DeprecatedFunctions.Deprecated
  assert_options(ASSERT_EXCEPTION, TRUE);
}