class Handle

Same name in other branches
  1. 9 core/lib/Drupal/Component/Assertion/Handle.php \Drupal\Component\Assertion\Handle
  2. 8.9.x core/lib/Drupal/Component/Assertion/Handle.php \Drupal\Component\Assertion\Handle
  3. 10 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

1 string reference to 'Handle'
BanMiddlewareTest::testBannedIp in core/modules/ban/tests/src/Unit/BanMiddlewareTest.php
Tests a banned IP.

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

Title Sort descending Modifiers Object type Summary
Handle::register public static function Ensures exceptions are thrown when an assertion fails.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.