Skip to content
Snippets Groups Projects
Unverified Commit 7769a956 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3517614 by alexpott, longwave, cmlara, catch, quietone, mstrelan:...

Issue #3517614 by alexpott, longwave, cmlara, catch, quietone, mstrelan: Possible Non GPLv2 compatible code in ExpectDeprecationTrait

(cherry picked from commit 405ac9da)
parent bb1a18b7
Branches
Tags
6 merge requests!12227Issue #3181946 by jonmcl, mglaman,!12079Issue #3523476 by matthiasm11: Add empty check on operator,!12024Fix: DocBlock comment for return value of Drupal\Core\Database\Connection::transactionManager(),!11974Draft: Issue #3495165 by catch, joeyroth, berdir, texas-bronius: Better warning...,!11934Issue #3520997: DefaultLazyPluginCollection unnecessarily instantiates plugins when sorting collection,!11887Issue #3520065: The migrate Row class API is incomplete
Pipeline #476637 passed
Pipeline: drupal

#476639

    ......@@ -63,10 +63,7 @@ public function tearDownErrorHandler(): void {
    // restored during ::tearDown().
    $handler = Error::currentErrorHandler();
    if (!$handler instanceof TestErrorHandler) {
    throw new \RuntimeException(sprintf('%s registered its own error handler (%s) without restoring the previous one before or during tear down. This can cause unpredictable test results. Ensure the test cleans up after itself.',
    $this->name(),
    self::getCallableName($handler),
    ));
    throw new \RuntimeException(sprintf('%s registered its own error handler without restoring the previous one before or during tear down. This can cause unpredictable test results. Ensure the test cleans up after itself.', $this->name()));
    }
    restore_error_handler();
    ......@@ -97,41 +94,4 @@ public function expectDeprecation(string $message): void {
    DeprecationHandler::expectDeprecation($message);
    }
    /**
    * Returns a callable as a string suitable for inclusion in a message.
    *
    * @param callable $callable
    * The callable.
    *
    * @return string
    * The string suitable for inclusion in a message.
    *
    * @see https://stackoverflow.com/questions/34324576/print-name-or-definition-of-callable-in-php
    */
    private static function getCallableName(callable $callable): string {
    switch (TRUE) {
    case is_string($callable) && strpos($callable, '::'):
    return '[static] ' . $callable;
    case is_string($callable):
    return '[function] ' . $callable;
    case is_array($callable) && is_object($callable[0]):
    return '[method] ' . get_class($callable[0]) . '->' . $callable[1];
    case is_array($callable):
    return '[static] ' . $callable[0] . '::' . $callable[1];
    case $callable instanceof \Closure:
    return '[closure]';
    case is_object($callable):
    return '[invokable] ' . get_class($callable);
    default:
    return '[unknown]';
    }
    }
    }
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment