From 075cd9522622a25c0c47d0ef9cd71de502bfe6af Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Fri, 29 May 2020 15:58:45 +0100
Subject: [PATCH] Issue #3143085 by neclimdul: Define and optimize alias
 definition in OptimizedPhpArrayDumper

---
 .../Dumper/OptimizedPhpArrayDumper.php                 | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php b/core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php
index 977fc2c8e9ff..889d2667270f 100644
--- a/core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php
+++ b/core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php
@@ -46,6 +46,13 @@ class OptimizedPhpArrayDumper extends Dumper {
    */
   protected $serialize = TRUE;
 
+  /**
+   * A list of container aliases.
+   *
+   * @var array
+   */
+  protected $aliases;
+
   /**
    * {@inheritdoc}
    */
@@ -61,8 +68,9 @@ public function dump(array $options = []) {
    */
   public function getArray() {
     $definition = [];
+    // Warm aliases first.
     $this->aliases = $this->getAliases();
-    $definition['aliases'] = $this->getAliases();
+    $definition['aliases'] = $this->aliases;
     $definition['parameters'] = $this->getParameters();
     $definition['services'] = $this->getServiceDefinitions();
     $definition['frozen'] = $this->container->isCompiled();
-- 
GitLab