function SettingsForm::demonstrateErrorHandlers

Same name in other branches
  1. 4.x src/Form/SettingsForm.php \Drupal\devel\Form\SettingsForm::demonstrateErrorHandlers()

Demonstrates the capabilities of the error handler.

Parameters

string $severity: The severity level for which demonstrate the error handler capabilities.

1 call to SettingsForm::demonstrateErrorHandlers()
SettingsForm::buildForm in src/Form/SettingsForm.php
Form constructor.

File

src/Form/SettingsForm.php, line 190

Class

SettingsForm
Defines a form that configures devel settings.

Namespace

Drupal\devel\Form

Code

protected function demonstrateErrorHandlers(string $severity) : void {
    switch ($severity) {
        case 'notice':
            trigger_error('This is an example notice', E_USER_NOTICE);
            break;
        case 'warning':
            trigger_error('This is an example notice', E_USER_NOTICE);
            trigger_error('This is an example warning', E_USER_WARNING);
            break;
        case 'error':
            trigger_error('This is an example notice', E_USER_NOTICE);
            trigger_error('This is an example warning', E_USER_WARNING);
            trigger_error('This is an example error', E_USER_ERROR);
    }
}