Commit 4371e3ce authored by catch's avatar catch
Browse files

task: #3575461 Cleanup any remaining deprecations

By: smustgrave
By: nicxvan
By: quietone
By: dcam
By: mondrake
By: catch
By: godotislate
parent aa94eca6
Loading
Loading
Loading
Loading
+0 −70
Changes for composer/Generator/Builder/DrupalPinnedDevDependenciesBuilder.php: 0 added lines, 70 removed lines.
Original line number Diff line number Diff line
<?php

namespace Drupal\Composer\Generator\Builder;

use Drupal\Composer\Composer;

/**
 * Builder to produce metapackage for drupal/core-dev-pinned.
 *
 * @deprecated in drupal:11.4.0 and is removed from drupal:12.0.0. Use
 *   drupal/core-dev instead.
 *
 * @see https://www.drupal.org/node/3566742
 */
class DrupalPinnedDevDependenciesBuilder extends DrupalPackageBuilder {

  /**
   * {@inheritdoc}
   */
  public function getPath() {
    return 'PinnedDevDependencies';
  }

  /**
   * {@inheritdoc}
   */
  public function getPackage() {

    $composer = $this->initialPackageMetadata();

    // Pull the exact versions of the dependencies from the composer.lock
    // file and use it to build our 'require' section.
    $composerLockData = $this->drupalCoreInfo->composerLock();

    if (isset($composerLockData['packages-dev'])) {
      foreach ($composerLockData['packages-dev'] as $package) {
        $composer['require'][$package['name']] = $package['version'];
      }
    }
    return $composer;
  }

  /**
   * Returns the initial package metadata that describes the metapackage.
   *
   * @return array
   *   The initial package metadata.
   */
  protected function initialPackageMetadata() {
    return [
      "name" => "drupal/core-dev-pinned",
      "type" => "metapackage",
      "description" => "Deprecated. Pinned require-dev dependencies from drupal/drupal; use in addition to drupal/core-recommended to run tests from drupal/core. Use drupal/core-dev instead to avoid security vulnerabilities from pinned versions.",
      "license" => "GPL-2.0-or-later",
      "abandoned" => "drupal/core-dev",
      "conflict" => [
        "webflo/drupal-core-require-dev" => "*",
      ],
      "require" => [
        "drupal/core" => Composer::drupalVersionBranch(),
      ],
      "extra" => [
        "branch-alias" => [
          "dev-main" => Composer::drupalVersionBranch(),
        ],
      ],
    ];
  }

}
+0 −3
Changes for composer/Generator/PackageGenerator.php: 0 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -4,7 +4,6 @@

use Drupal\Composer\Generator\Builder\DrupalCoreRecommendedBuilder;
use Drupal\Composer\Generator\Builder\DrupalDevDependenciesBuilder;
use Drupal\Composer\Generator\Builder\DrupalPinnedDevDependenciesBuilder;
use Drupal\Composer\Generator\Util\DrupalCoreComposer;
use Composer\Util\Filesystem;
use Composer\IO\IOInterface;
@@ -70,8 +69,6 @@ protected function builders() {
    return [
      DrupalCoreRecommendedBuilder::class,
      DrupalDevDependenciesBuilder::class,
      // @phpstan-ignore classConstant.deprecatedClass
      DrupalPinnedDevDependenciesBuilder::class,
    ];
  }

+0 −60
Changes for core/.phpstan-baseline.php: 0 added lines, 60 removed lines.
Original line number Diff line number Diff line
@@ -7549,12 +7549,6 @@
	'count' => 1,
	'path' => __DIR__ . '/lib/Drupal/Core/Installer/InstallerModuleExtensionList.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',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\Core\\\\Installer\\\\InstallerServiceProvider\\:\\:alter\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
@@ -13887,24 +13881,6 @@
	'count' => 1,
	'path' => __DIR__ . '/modules/help/src/HelpTopicTwigLoader.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\help\\\\Plugin\\\\Search\\\\HelpSearch\\:\\:indexClear\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/modules/help/src/Plugin/Search/HelpSearch.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\help\\\\Plugin\\\\Search\\\\HelpSearch\\:\\:markForReindex\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/modules/help/src/Plugin/Search/HelpSearch.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\help\\\\Plugin\\\\Search\\\\HelpSearch\\:\\:updateIndex\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/modules/help/src/Plugin/Search/HelpSearch.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\Tests\\\\help\\\\Kernel\\\\HelpTopicTest\\:\\:assertBreadcrumb\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
@@ -19035,36 +19011,6 @@
	'count' => 1,
	'path' => __DIR__ . '/modules/node/src/NodeViewBuilder.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\node\\\\Plugin\\\\Search\\\\NodeSearch\\:\\:indexClear\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/modules/node/src/Plugin/Search/NodeSearch.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\node\\\\Plugin\\\\Search\\\\NodeSearch\\:\\:indexStatus\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/modules/node/src/Plugin/Search/NodeSearch.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\node\\\\Plugin\\\\Search\\\\NodeSearch\\:\\:markForReindex\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/modules/node/src/Plugin/Search/NodeSearch.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\node\\\\Plugin\\\\Search\\\\NodeSearch\\:\\:submitConfigurationForm\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/modules/node/src/Plugin/Search/NodeSearch.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\node\\\\Plugin\\\\Search\\\\NodeSearch\\:\\:updateIndex\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/modules/node/src/Plugin/Search/NodeSearch.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\node\\\\Plugin\\\\views\\\\argument\\\\Type\\:\\:node_type\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
@@ -32807,12 +32753,6 @@
	'count' => 1,
	'path' => __DIR__ . '/tests/Drupal/FunctionalJavascriptTests/Tests/DrupalSelenium2DriverTest.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\FunctionalTests\\\\Installer\\\\InstallerTestBase\\:\\:setUpProfile\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/tests/Drupal/FunctionalTests/Installer/InstallerTestBase.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\FunctionalTests\\\\MailCaptureTest\\:\\:assertMailPattern\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
+0 −5
Changes for core/lib/Drupal/Core/Access/CsrfRequestHeaderAccessCheck.php: 0 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -74,14 +74,9 @@ public function access(Request $request, AccountInterface $account) {
      }
      $csrf_token = $request->headers->get('X-CSRF-Token');
      if (!$this->csrfToken->validate($csrf_token, self::TOKEN_KEY)) {
        if ($this->csrfToken->validate($csrf_token, 'rest')) {
          @trigger_error("Validating CSRF tokens with the 'rest' key is deprecated in drupal:11.4.0 and is removed from drupal:12.0.0. Sessions created before the upgrade to Drupal 9 are no longer supported. See https://www.drupal.org/node/3591939", E_USER_DEPRECATED);
        }
        else {
        return AccessResult::forbidden()->setReason('X-CSRF-Token request header is invalid')->setCacheMaxAge(0);
      }
    }
    }
    // Let other access checkers decide if the request is legit.
    return AccessResult::allowed()->setCacheMaxAge(0);
  }
+2 −8
Changes for core/lib/Drupal/Core/Hook/ThemeHookCollectorPass.php: 2 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -226,22 +226,16 @@ protected function collectThemeHookImplementations($dir, $theme, $currentThemePr
    $hookFileCache = FileCacheFactory::get('theme_hook_implementations');
    $proceduralHookFileCache = FileCacheFactory::get('theme_procedural_hook_implementations:' . $allThemesPreg);

    foreach ($this->getHookFileIterator($dir, ["$theme.theme", 'theme-settings.php']) as $fileinfo) {
    foreach ($this->getHookFileIterator($dir, ["$theme.theme"]) as $fileinfo) {
      assert($fileinfo instanceof \SplFileInfo);
      $fileExtension = $fileinfo->getExtension();
      $filename = $fileinfo->getPathname();

      $isThemeSettings = str_ends_with($filename, 'theme-settings.php');

      if ($fileExtension === 'theme') {
        $this->deprecatedThemeFiles[pathinfo($filename, PATHINFO_FILENAME)] = TRUE;
      }

      if ($isThemeSettings) {
        @trigger_error('Using a theme-settings.php file in the ' . $theme . ' theme is deprecated in drupal:11.5.0 and is removed from drupal:12.0.0. Convert the hooks to use attributes or move to the .theme file. See https://www.drupal.org/node/3587273', E_USER_DEPRECATED);
      }

      if ($fileExtension === 'php' && !$isThemeSettings) {
      if ($fileExtension === 'php') {
        $cached = $hookFileCache->get($filename);
        if ($cached) {
          $class = $cached['class'];
Loading