function DeprecationListenerTrait::isDeprecationSkipped

Determines if a deprecation error should be skipped.

Return value

bool TRUE if the deprecation error should be skipped, FALSE if not.

2 calls to DeprecationListenerTrait::isDeprecationSkipped()
DeprecationListenerTrait::deprecationEndTest in core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php
Reacts to the end of a test.
DeprecationListenerTrait::registerErrorHandler in core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php
Registers an error handler that wraps Symfony's DeprecationErrorHandler.

File

core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php, line 67

Class

DeprecationListenerTrait
Removes deprecations that we are yet to fix.

Namespace

Drupal\Tests\Listeners

Code

public static function isDeprecationSkipped($message) {
    if (in_array($message, static::getSkippedDeprecations(), TRUE)) {
        return TRUE;
    }
    $dynamic_skipped_deprecations = [
        '%The "[^"]+" class extends "Symfony\\\\Component\\\\EventDispatcher\\\\Event" that is deprecated since Symfony 4\\.3, use "Symfony\\\\Contracts\\\\EventDispatcher\\\\Event" instead\\.$%',
        '%The "Symfony\\\\Component\\\\Validator\\\\Context\\\\ExecutionContextInterface::.*\\(\\)" method is considered internal Used by the validator engine\\. Should not be called by user\\W+code\\. It may change without further notice\\. You should not extend it from "[^"]+".%',
        '%The "PHPUnit\\\\Framework\\\\TestCase::addWarning\\(\\)" method is considered internal%',
        // The following deprecations were not added as part of the original
        // issues and thus were not addressed in time for the 9.0.0 release.
'%The entity link url update for the "\\w+" view is deprecated in drupal:9.0.0 and is removed from drupal:10.0.0. Module-provided Views configuration should be updated to accommodate the changes described at https://www.drupal.org/node/2857891.%',
        '%The operator defaults update for the "\\w+" view is deprecated in drupal:9.0.0 and is removed from drupal:10.0.0. Module-provided Views configuration should be updated to accommodate the changes described at https://www.drupal.org/node/2869168.%',
        // Guzzle 6 will not be updated for full PHP 8.1 compatibility, see
        // https://github.com/guzzle/guzzle/pull/2918.
'%Return type of GuzzleHttp\\\\.* should either be compatible with .*, or the #\\[\\\\ReturnTypeWillChange\\] attribute should be used to temporarily suppress the notice%',
        // Skip EasyRdf deprecations for PHP 8.1 - fixed by
        // https://github.com/easyrdf/easyrdf/pull/384.
'%Return type of EasyRdf\\\\.* should either be compatible with .*, or the #\\[\\\\ReturnTypeWillChange\\] attribute should be used to temporarily suppress the notice%',
        // Skip non-Symfony DebugClassLoader forward compatibility warnings.
'%Method "(?!Symfony\\\\)[^"]+" might add "[^"]+" as a native return type declaration in the future. Do the same in (child class|implementation) "[^"]+" now to avoid errors or add an explicit @return annotation to suppress this message%',
        // Skip DebugClassLoader false positives.
'%Method "Symfony\\\\Cmf\\\\[^"]+" might add "[^"]+" as a native return type declaration in the future. Do the same in (child class|implementation) "Drupal\\\\[^"]+" now to avoid errors or add an explicit @return annotation to suppress this message%',
        '%Method "[^"]+" might add "[^"]+" as a native return type declaration in the future. Do the same in (child class|implementation) "(?!Drupal\\\\)[^"]+" now to avoid errors or add an explicit @return annotation to suppress this message%',
        '%The "Drupal\\\\[^"]+" method will require a new "[^"]+" argument in the next major version of its interface "Drupal\\\\[^"]+", not defining it is deprecated%',
        // Symfony 5.4
'%Method "Symfony\\\\Component\\\\Serializer\\\\Normalizer\\\\NormalizerInterface::normalize\\(\\)" might add "array\\|string\\|int\\|float\\|bool\\|\\\\ArrayObject\\|null" as a native return type declaration in the future. Do the same in implementation "(?!Drupal\\\\)[^"]+" now to avoid errors or add an explicit @return annotation to suppress this message.%',
    ];
    return (bool) preg_filter($dynamic_skipped_deprecations, '$0', $message);
}

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