Verified Commit 8a9850a4 authored by godotislate's avatar godotislate
Browse files

task: #3620746 Remove deprecated methods and functions tagged for 12.0.0

By: longwave
By: smustgrave
parent bb5d24ea
Loading
Loading
Loading
Loading
+6 −12
Changes for core/.phpstan-baseline.php: 6 added lines, 12 removed lines.
Original line number Diff line number Diff line
@@ -5431,12 +5431,6 @@
	'count' => 1,
	'path' => __DIR__ . '/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\Core\\\\Entity\\\\Sql\\\\SqlContentEntityStorage\\:\\:loadFromSharedTables\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\Core\\\\Entity\\\\Sql\\\\SqlContentEntityStorage\\:\\:onBundleCreate\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
@@ -30783,12 +30777,6 @@
	'count' => 1,
	'path' => __DIR__ . '/modules/views/src/Views.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\views\\\\ViewsData\\:\\:cacheSet\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/modules/views/src/ViewsData.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\views\\\\ViewsData\\:\\:clear\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
@@ -33375,5 +33363,11 @@
	'count' => 1,
	'path' => __DIR__ . '/themes/olivero/src/OliveroPreRender.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\Core\\\\Installer\\\\InstallerRouteBuilder\\:\\:getRouteDefinitions\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/lib/Drupal/Core/Installer/InstallerRouteBuilder.php',
];
return ['parameters' => ['ignoreErrors' => $ignoreErrors]];
+0 −17
Changes for core/lib/Drupal/Core/Command/ServerCommand.php: 0 added lines, 17 removed lines.
Original line number Diff line number Diff line
@@ -179,23 +179,6 @@ protected function openBrowser($url, SymfonyStyle $io) {
    $process->start();
  }

  /**
   * Gets a one time login URL for user 1.
   *
   * @return string
   *   The one time login URL for user 1.
   *
   * @deprecated in drupal:11.4.0 and is removed from drupal:12.0.0. There is no
   *   replacement.
   * @see https://www.drupal.org/node/3581062
   */
  protected function getOneTimeLoginUrl() {
    @trigger_error(__METHOD__ . '() is deprecated in drupal:11.4.0 and is removed from drupal:12.0.0. There is no replacement. See https://www.drupal.org/node/3581062', E_USER_DEPRECATED);
    $user = User::load(1);
    \Drupal::moduleHandler()->load('user');
    return user_pass_reset_url($user);
  }

  /**
   * Starts up a webserver with a running Drupal.
   *
+0 −109
Changes for core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php: 0 added lines, 109 removed lines.
Original line number Diff line number Diff line
@@ -534,115 +534,6 @@ protected function mapFromStorageRecords(array $records, $load_from_revision = F
    return $entities;
  }

  /**
   * Loads values for fields stored in the shared data tables.
   *
   * @param array &$values
   *   Associative array of entities values, keyed on the entity ID or the
   *   revision ID.
   * @param array &$translations
   *   List of translations, keyed on the entity ID.
   * @param bool $load_from_revision
   *   Flag to indicate whether revisions should be loaded or not.
   *
   * @deprecated in drupal:11.4.0 and is removed from drupal:12.0.0. There is no
   * replacement.
   * @see https://www.drupal.org/node/3586362
   */
  protected function loadFromSharedTables(array &$values, array &$translations, $load_from_revision) {
    @trigger_error(__METHOD__ . '() is deprecated in drupal:11.4.0 and is removed from drupal:12.0.0. There is no replacement. See https://www.drupal.org/node/3586362');
    $record_key = !$load_from_revision ? $this->idKey : $this->revisionKey;
    if ($this->dataTable) {
      // If a revision table is available, we need all the properties of the
      // latest revision. Otherwise we fall back to the data table.
      $table = $this->revisionDataTable ?: $this->dataTable;
      $alias = $this->revisionDataTable ? 'revision' : 'data';
      $query = $this->database->select($table, $alias, ['fetch' => FetchAs::Associative])
        ->fields($alias)
        ->condition($alias . '.' . $record_key, array_keys($values), 'IN')
        ->orderBy($alias . '.' . $record_key);

      $table_mapping = $this->getTableMapping();
      if ($this->revisionDataTable) {
        // Find revisioned fields that are not entity keys. Exclude the langcode
        // key as the base table holds only the default language.
        $base_fields = array_diff($table_mapping->getFieldNames($this->baseTable), [$this->langcodeKey]);
        $revisioned_fields = array_diff($table_mapping->getFieldNames($this->revisionDataTable), $base_fields);

        // Find fields that are not revisioned or entity keys. Data fields have
        // the same value regardless of entity revision.
        $data_fields = array_diff($table_mapping->getFieldNames($this->dataTable), $revisioned_fields, $base_fields);
        // If there are no data fields then only revisioned fields are needed
        // else both data fields and revisioned fields are needed to map the
        // entity values.
        $all_fields = $revisioned_fields;
        if ($data_fields) {
          $all_fields = array_merge($revisioned_fields, $data_fields);
          $query->leftJoin($this->dataTable, 'data', "([revision].[$this->idKey] = [data].[$this->idKey] AND [revision].[$this->langcodeKey] = [data].[$this->langcodeKey])");
          $column_names = [];
          // Some fields can have more then one columns in the data table so
          // column names are needed.
          foreach ($data_fields as $data_field) {
            // \Drupal\Core\Entity\Sql\TableMappingInterface::getColumnNames()
            // returns an array keyed by property names so remove the keys
            // before array_merge() to avoid losing data with fields having the
            // same columns i.e. value.
            $column_names[] = array_values($table_mapping->getColumnNames($data_field));
          }
          $column_names = array_merge(...$column_names);
          $query->fields('data', $column_names);
        }

        // Get the revision IDs.
        $revision_ids = [];
        foreach ($values as $entity_values) {
          $revision_ids[] = $entity_values[$this->revisionKey][LanguageInterface::LANGCODE_DEFAULT];
        }
        $query->condition('revision.' . $this->revisionKey, $revision_ids, 'IN');
      }
      else {
        $all_fields = $table_mapping->getFieldNames($this->dataTable);
      }

      $result = $query->execute();

      $field_definition_columns = [];
      $field_columns = [];

      foreach ($all_fields as $field_name) {
        $field_definition_columns[$field_name] = $this->fieldStorageDefinitions[$field_name]->getColumns();
        $field_columns[$field_name] = $table_mapping->getColumnNames($field_name);
      }

      foreach ($result as $row) {
        $id = $row[$record_key];

        // Field values in default language are stored with
        // LanguageInterface::LANGCODE_DEFAULT as key.
        $langcode = empty($row[$this->defaultLangcodeKey]) ? $row[$this->langcodeKey] : LanguageInterface::LANGCODE_DEFAULT;

        $translations[$id][$langcode] = TRUE;

        foreach ($all_fields as $field_name) {
          $definition_columns = $field_definition_columns[$field_name];
          $columns = $field_columns[$field_name];
          // Do not key single-column fields by property name.
          if (count($columns) == 1) {
            $column_name = reset($columns);
            $column_attributes = $definition_columns[key($columns)];
            $values[$id][$field_name][$langcode] = (!empty($column_attributes['serialize'])) ? $this->handleNullableFieldUnserialize($row[$column_name]) : $row[$column_name];
          }
          else {
            foreach ($columns as $property_name => $column_name) {
              $column_attributes = $definition_columns[$property_name];
              $values[$id][$field_name][$langcode][$property_name] = (!empty($column_attributes['serialize'])) ? $this->handleNullableFieldUnserialize($row[$column_name]) : $row[$column_name];
            }
          }
        }
      }
    }
  }

  /**
   * {@inheritdoc}
   */
+0 −20
Changes for core/lib/Drupal/Core/Routing/RouteBuilder.php: 0 added lines, 20 removed lines.
Original line number Diff line number Diff line
@@ -4,7 +4,6 @@

use Drupal\Core\Access\CheckProviderInterface;
use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
use Drupal\Core\Discovery\YamlDiscovery;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Lock\LockBackendInterface;
use Drupal\Core\DestructableInterface;
@@ -172,23 +171,4 @@ public function destruct() {
    $this->rebuildIfNeeded();
  }

  /**
   * Retrieves all defined routes from .routing.yml files.
   *
   * @return array
   *   The defined routes, keyed by provider.
   *
   * @deprecated in drupal:11.4.0 and is removed from drupal:12.0.0. This code
   *   has moved to \Drupal\Core\Routing\YamlRouteDiscovery.
   *
   * @see https://www.drupal.org/node/3324758
   */
  protected function getRouteDefinitions() {
    @trigger_error(__METHOD__ . '() is deprecated in drupal:11.4.0 and is removed from drupal:12.0.0. This code has moved to \Drupal\Core\Routing\YamlRouteDiscovery. See https://www.drupal.org/node/3324758', E_USER_DEPRECATED);
    // Always instantiate a new YamlDiscovery object so that we always search on
    // the up-to-date list of modules.
    $discovery = new YamlDiscovery('routing', $this->moduleHandler->getModuleDirectories());
    return $discovery->findAll();
  }

}
+0 −15
Changes for core/modules/block/src/BlockListBuilder.php: 0 added lines, 15 removed lines.
Original line number Diff line number Diff line
@@ -384,19 +384,4 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
    $this->messenger->addStatus($this->t('The block settings have been updated.'));
  }

  /**
   * Wraps system_region_list().
   *
   * @deprecated in drupal:11.4.0 and is removed from drupal:12.0.0. Use
   *   $this->themeHandler->getTheme()->listAllRegions() or
   *   $this->themeHandler->getTheme()->listVisibleRegions() instead.
   *
   * @see https://www.drupal.org/node/3015925
   */
  // @phpstan-ignore-next-line
  protected function systemRegionList($theme, $show = REGIONS_ALL) {
    @trigger_error(__CLASS__ . '::systemRegionList() is deprecated in drupal:11.4.0 and is removed from drupal:12.0.0. Use $this->themeHandler->getTheme()->listAllRegions() or $this->themeHandler->getTheme()->listVisibleRegions() instead. See https://www.drupal.org/node/3015925', E_USER_DEPRECATED);
    return $show === 'all' ? $this->themeHandler->getTheme($theme)->listAllRegions() : $this->themeHandler->getTheme($theme)->listVisibleRegions();
  }

}
Loading