Handle.php

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

Namespace

Drupal\Component\Assertion

File

core/lib/Drupal/Component/Assertion/Handle.php

View source
<?php

namespace Drupal\Component\Assertion;


/**
 * Handler for runtime assertion failures.
 *
 * @ingroup php_assert
 *
 * @todo Deprecate this class. https://www.drupal.org/node/3054072
 */
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);
    }

}

Classes

Title Deprecated Summary
Handle Handler for runtime assertion failures.

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