Verified Commit d8435a06 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3285503 by quietone, longwave: Remove deprecated code in constructors

parent cc39d49f
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -41,12 +41,8 @@ class EntityLastInstalledSchemaRepository implements EntityLastInstalledSchemaRe
   * @param \Drupal\Core\Cache\CacheBackendInterface $cache
   *   The cache backend.
   */
  public function __construct(KeyValueFactoryInterface $key_value_factory, CacheBackendInterface $cache = NULL) {
  public function __construct(KeyValueFactoryInterface $key_value_factory, CacheBackendInterface $cache) {
    $this->keyValueFactory = $key_value_factory;
    if (!$cache) {
      @trigger_error('The cache.discovery service must be passed to EntityLastInstalledSchemaRepository::__construct(), it is required before drupal:10.0.0.', E_USER_DEPRECATED);
      $cache = \Drupal::cache('discovery');
    }
    $this->cacheBackend = $cache;
  }

+1 −10
Original line number Diff line number Diff line
@@ -103,20 +103,11 @@ class SharedTempStore {
   * @param int $expire
   *   The time to live for items, in seconds.
   */
  public function __construct(KeyValueStoreExpirableInterface $storage, LockBackendInterface $lock_backend, $owner, RequestStack $request_stack, $current_user = NULL, $expire = 604800) {
  public function __construct(KeyValueStoreExpirableInterface $storage, LockBackendInterface $lock_backend, $owner, RequestStack $request_stack, AccountProxyInterface $current_user, $expire = 604800) {
    $this->storage = $storage;
    $this->lockBackend = $lock_backend;
    $this->owner = $owner;
    $this->requestStack = $request_stack;
    if (!$current_user instanceof AccountProxyInterface) {
      @trigger_error('Calling ' . __METHOD__ . '() without the $current_user argument is deprecated in drupal:9.2.0 and will be required in drupal:10.0.0. See https://www.drupal.org/node/3006268', E_USER_DEPRECATED);
      if (is_int($current_user)) {
        // If the $current_user argument is numeric then this object has been
        // instantiated with the old constructor signature.
        $expire = $current_user;
      }
      $current_user = \Drupal::currentUser();
    }
    $this->currentUser = $current_user;
    $this->expire = $expire;
  }
+1 −10
Original line number Diff line number Diff line
@@ -62,19 +62,10 @@ class SharedTempStoreFactory {
   * @param int $expire
   *   The time to live for items, in seconds.
   */
  public function __construct(KeyValueExpirableFactoryInterface $storage_factory, LockBackendInterface $lock_backend, RequestStack $request_stack, $current_user = NULL, $expire = 604800) {
  public function __construct(KeyValueExpirableFactoryInterface $storage_factory, LockBackendInterface $lock_backend, RequestStack $request_stack, AccountProxyInterface $current_user, $expire = 604800) {
    $this->storageFactory = $storage_factory;
    $this->lockBackend = $lock_backend;
    $this->requestStack = $request_stack;
    if (!$current_user instanceof AccountProxyInterface) {
      @trigger_error('Calling ' . __METHOD__ . '() without the $current_user argument is deprecated in drupal:9.2.0 and will be required in drupal:10.0.0. See https://www.drupal.org/node/3006268', E_USER_DEPRECATED);
      if (is_int($current_user)) {
        // If the $current_user argument is numeric then this object has been
        // instantiated with the old constructor signature.
        $expire = $current_user;
      }
      $current_user = \Drupal::currentUser();
    }
    $this->currentUser = $current_user;
    $this->expire = $expire;
  }
+1 −5
Original line number Diff line number Diff line
@@ -83,15 +83,11 @@ class TwigExtension extends AbstractExtension {
   * @param \Drupal\Core\File\FileUrlGeneratorInterface $file_url_generator
   *   The file URL generator.
   */
  public function __construct(RendererInterface $renderer, UrlGeneratorInterface $url_generator, ThemeManagerInterface $theme_manager, DateFormatterInterface $date_formatter, FileUrlGeneratorInterface $file_url_generator = NULL) {
  public function __construct(RendererInterface $renderer, UrlGeneratorInterface $url_generator, ThemeManagerInterface $theme_manager, DateFormatterInterface $date_formatter, FileUrlGeneratorInterface $file_url_generator) {
    $this->renderer = $renderer;
    $this->urlGenerator = $url_generator;
    $this->themeManager = $theme_manager;
    $this->dateFormatter = $date_formatter;
    if (!$file_url_generator) {
      @trigger_error('Calling TwigExtension::__construct() without the $file_url_generator argument is deprecated in drupal:9.3.0 and will be required in drupal:10.0.0. See https://www.drupal.org/node/2940031.', E_USER_DEPRECATED);
      $file_url_generator = \Drupal::service('file_url_generator');
    }
    $this->fileUrlGenerator = $file_url_generator;
  }

+1 −9
Original line number Diff line number Diff line
@@ -105,22 +105,14 @@ class CKEditor extends EditorBase implements ContainerFactoryPluginInterface {
   * @param \Drupal\Core\Extension\ModuleExtensionList $module_list
   *   The module list service.
   */
  public function __construct(array $configuration, $plugin_id, $plugin_definition, CKEditorPluginManager $ckeditor_plugin_manager, ModuleHandlerInterface $module_handler, LanguageManagerInterface $language_manager, RendererInterface $renderer, StateInterface $state, FileUrlGeneratorInterface $file_url_generator = NULL, ModuleExtensionList $module_list = NULL) {
  public function __construct(array $configuration, $plugin_id, $plugin_definition, CKEditorPluginManager $ckeditor_plugin_manager, ModuleHandlerInterface $module_handler, LanguageManagerInterface $language_manager, RendererInterface $renderer, StateInterface $state, FileUrlGeneratorInterface $file_url_generator, ModuleExtensionList $module_list) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this->ckeditorPluginManager = $ckeditor_plugin_manager;
    $this->moduleHandler = $module_handler;
    $this->languageManager = $language_manager;
    $this->renderer = $renderer;
    $this->state = $state;
    if (!$file_url_generator) {
      @trigger_error('Calling CKEditor::__construct() without the $file_url_generator argument is deprecated in drupal:9.3.0 and will be required before drupal:10.0.0. See https://www.drupal.org/node/2940031', E_USER_DEPRECATED);
      $file_url_generator = \Drupal::service('file_url_generator');
    }
    $this->fileUrlGenerator = $file_url_generator;
    if (!$module_list) {
      @trigger_error('Calling CKEditor::__construct() without the $module_list argument is deprecated in drupal:9.3.0 and is required in drupal:10.0.0. See https://www.drupal.org/node/2940438', E_USER_DEPRECATED);
      $module_list = \Drupal::service('extension.list.module');
    }
    $this->moduleList = $module_list;
  }

Loading