function DeprecationHandler::isIgnoredByProject

Same name and namespace in other branches
  1. main core/tests/Drupal/TestTools/Extension/DeprecationBridge/DeprecationHandler.php \Drupal\TestTools\Extension\DeprecationBridge\DeprecationHandler::isIgnoredByProject()

Determines if an actual deprecation is ignored by the project.

Deprecations that match the patterns included in the ignore file should be ignored.

Parameters

string $deprecationMessage: The actual deprecation message triggered via trigger_error().

Return value

bool TRUE if the deprecation is ignored at project level.

1 call to DeprecationHandler::isIgnoredByProject()
DeprecationHandler::handle in core/tests/Drupal/TestTools/Extension/DeprecationBridge/DeprecationHandler.php
Handles a deprecation error.

File

core/tests/Drupal/TestTools/Extension/DeprecationBridge/DeprecationHandler.php, line 159

Class

DeprecationHandler
Drupal's PHPUnit extension to manage code deprecation.

Namespace

Drupal\TestTools\Extension\DeprecationBridge

Code

private static function isIgnoredByProject(string $deprecationMessage) : bool {
  foreach (Configuration::instance()->deprecationIgnorePatterns as $pattern) {
    $result = @preg_filter($pattern, '$0', $deprecationMessage);
    if (preg_last_error() !== \PREG_NO_ERROR) {
      throw new \RuntimeException(preg_last_error_msg());
    }
    if ((bool) $result) {
      return TRUE;
    }
  }
  return FALSE;
}

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