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

Handler for runtime assertion failures.

Hierarchy

  • class \Drupal\Component\Assertion\Handle

Expanded class hierarchy of Handle

Deprecated

in drupal:10.1.0 and is removed from drupal:11.0.0. Use assert_options(ASSERT_EXCEPTION, TRUE).

See also

https://www.drupal.org/node/3105918

Related topics

File

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

Namespace

Drupal\Component\Assertion
View source
class Handle {

  /**
   * Ensures exceptions are thrown when an assertion fails.
   */
  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);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Handle::register public static function Ensures exceptions are thrown when an assertion fails.