$string, 'calledInsideWithNoReplacement' => self::$insideWithNoReplacement ]; } else { if (!self::isEnabled()) { // Do not add to self::$userErrorMessageBuffer, as the backtrace is too expensive return; } // Getting a backtrace is slow, so we only do it if we need it $backtrace = null; // Get the calling scope if ($scope == Deprecation::SCOPE_METHOD) { $backtrace = debug_backtrace(0); $caller = self::get_called_method_from_trace($backtrace, 1); } elseif ($scope == Deprecation::SCOPE_CLASS) { $backtrace = debug_backtrace(0); $caller = isset($backtrace[1]['class']) ? $backtrace[1]['class'] : '(unknown)'; } else { $caller = false; } if (substr($string, -1) != '.') { $string .= "."; } $level = self::$insideWithNoReplacement ? 4 : 2; $string .= " Called from " . self::get_called_method_from_trace($backtrace, $level) . '.'; if ($caller) { $string = $caller . ' is deprecated.' . ($string ? ' ' . $string : ''); } self::$userErrorMessageBuffer[] = [ 'message' => $string, 'calledInsideWithNoReplacement' => self::$insideWithNoReplacement ]; } if (!self::$haveSetShutdownFunction && self::isEnabled()) { // Use a shutdown function rather than immediately calling user_error() so that notices // do not interfere with setting session varibles i.e. headers already sent error // it also means the deprecation notices appear below all phpunit output in CI // which is far nicer than having it spliced between phpunit output register_shutdown_function(function () { self::outputNotices(); }); self::$haveSetShutdownFunction = true; } } catch (BadMethodCallException $e) { if ($e->getMessage() === InjectorLoader::NO_MANIFESTS_AVAILABLE) { // noop // this can happen when calling Deprecation::notice() before manifests are available, i.e. // some of the code involved in creating the manifests calls Deprecation::notice() } else { throw $e; } } finally { static::$insideNotice = false; } } /** * This method is no longer used * * @return array Opaque array that should only be used to pass to {@see Deprecation::restore_settings()} * @deprecated 4.12.0 Will be removed without equivalent functionality to replace it */ public static function dump_settings() { static::notice('4.12.0', 'Will be removed without equivalent functionality to replace it'); // noop } /** * This method is no longer used * * @param $settings array An array as returned by {@see Deprecation::dump_settings()} * @deprecated 4.12.0 Will be removed without equivalent functionality to replace it */ public static function restore_settings($settings) { static::notice('4.12.0', 'Will be removed without equivalent functionality to replace it'); // noop } }