class Handle

Same name in other branches
  1. 8.9.x core/lib/Drupal/Component/Assertion/Handle.php \Drupal\Component\Assertion\Handle
  2. 10 core/lib/Drupal/Component/Assertion/Handle.php \Drupal\Component\Assertion\Handle
  3. 11.x core/lib/Drupal/Component/Assertion/Handle.php \Drupal\Component\Assertion\Handle

Handler for runtime assertion failures.

@todo Deprecate this class. https://www.drupal.org/node/3054072

Hierarchy

  • class \Drupal\Component\Assertion\Handle

Expanded class hierarchy of Handle

Related topics

2 files declare their use of Handle
bootstrap.php in core/tests/bootstrap.php
Autoloader for Drupal PHPUnit testing.
DrupalKernel.php in core/lib/Drupal/Core/DrupalKernel.php
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 12

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.
        assert_options(ASSERT_WARNING, FALSE);
        // Turn exception throwing on.
        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.