Commit 280b1b92 authored by Gábor Hojtsy's avatar Gábor Hojtsy
Browse files

Issue #3272220 by Gábor Hojtsy: Remove dead code from twig deprecation checking

parent 31d16da7
Loading
Loading
Loading
Loading
+3 −21
Changes for src/DeprecationAnalyzer.php: 3 added lines, 21 removed lines.
Original line number Diff line number Diff line
@@ -11,8 +11,6 @@ use GuzzleHttp\Client;
use Psr\Log\LoggerInterface;
use Symfony\Component\Process\PhpExecutableFinder;
use Symfony\Component\Process\Process;
use Twig\Util\DeprecationCollector;
use Twig\Util\TemplateDirIterator;

final class DeprecationAnalyzer {

@@ -391,8 +389,8 @@ final class DeprecationAnalyzer {
      'data' => $json,
    ];

    $medataDeprecations = $this->extensionMetadataDeprecationAnalyzer->analyze($extension);
    $result['data']['totals']['upgrade_status_split']['declared_ready'] = empty($medataDeprecations);
    $metadataDeprecations = $this->extensionMetadataDeprecationAnalyzer->analyze($extension);
    $result['data']['totals']['upgrade_status_split']['declared_ready'] = empty($metadataDeprecations);

    // Run further deprecation analyzers and collect results.
    $more_deprecations = array_merge(
@@ -400,7 +398,7 @@ final class DeprecationAnalyzer {
      $this->libraryDeprecationAnalyzer->analyze($extension),
      $this->themeFunctionDeprecationAnalyzer->analyze($extension),
      (projectCollector::getDrupalCoreMajorVersion() > 8) ? $this->routeDeprecationAnalyzer->analyze($extension) : [],
      $medataDeprecations,
      $metadataDeprecations,
    );
    foreach ($more_deprecations as $one_deprecation) {
      $result['data']['files'][$one_deprecation->getFile()]['messages'][] = [
@@ -473,22 +471,6 @@ final class DeprecationAnalyzer {
    $this->scanResultStorage->set($extension->getName(), $result);
  }

  /**
   * Analyzes twig templates for calls of deprecated code.
   *
   * @param $directory
   *   The directory which Twig templates should be analyzed.
   *
   * @return array
   */
  protected function analyzeTwigTemplates($directory) {
    $iterator = new TemplateDirIterator(
      new TwigRecursiveIterator($directory)
    );
    return (new DeprecationCollector($this->twigEnvironment))
      ->collect($iterator);
  }

  /**
   * Prepare temporary directories for Upgrade Status.
   *