You are here

public function FormattableMarkupTest::errorHandler in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Component/Render/FormattableMarkupTest.php \Drupal\Tests\Component\Render\FormattableMarkupTest::errorHandler()
  2. 9 core/tests/Drupal/Tests/Component/Render/FormattableMarkupTest.php \Drupal\Tests\Component\Render\FormattableMarkupTest::errorHandler()

Custom error handler that saves the last error.

We need this custom error handler because we cannot rely on the error to exception conversion as __toString is never allowed to leak any kind of exception.

Parameters

int $error_number: The error number.

string $error_message: The error message.

File

core/tests/Drupal/Tests/Component/Render/FormattableMarkupTest.php, line 67

Class

FormattableMarkupTest
Tests the TranslatableMarkup class.

Namespace

Drupal\Tests\Component\Render

Code

public function errorHandler($error_number, $error_message) {
  $this->lastErrorNumber = $error_number;
  $this->lastErrorMessage = $error_message;
}