From e5909c5179605f2a10d288264a9ad81107c4d1c6 Mon Sep 17 00:00:00 2001
From: Igor Melnikov <imelnikov@magento.com>
Date: Wed, 2 Nov 2016 16:49:01 -0500
Subject: [PATCH] MAGETWO-60442: Add optional SerializerInterface dependency to
 child classes of \Magento\Framework\Config\Data

Adding SerializerInterface dependency in the constructor
---
 .../Catalog/Model/Attribute/Config/Data.php   | 17 ++++++++++++----
 .../Catalog/Model/ProductOptions/Config.php   | 10 +++++++---
 .../Magento/Cron/Model/Groups/Config/Data.php | 13 +++++++-----
 .../Eav/Model/Entity/Attribute/Config.php     |  8 +++-----
 .../Email/Model/Template/Config/Data.php      | 17 ++++++++++++----
 .../Search/Model/SearchEngine/Config/Data.php | 12 ++++++-----
 .../Api/ExtensionAttribute/Config.php         | 11 ++++++----
 .../App/ResourceConnection/Config.php         |  5 +++--
 .../Framework/Communication/Config/Data.php   | 20 +++++++++++--------
 .../Framework/Search/Request/Config.php       | 14 +++++++++----
 .../Module/Di/Code/Generator/PluginList.php   |  2 --
 11 files changed, 83 insertions(+), 46 deletions(-)

diff --git a/app/code/Magento/Catalog/Model/Attribute/Config/Data.php b/app/code/Magento/Catalog/Model/Attribute/Config/Data.php
index 032970a7461..2644e1fe83b 100644
--- a/app/code/Magento/Catalog/Model/Attribute/Config/Data.php
+++ b/app/code/Magento/Catalog/Model/Attribute/Config/Data.php
@@ -1,22 +1,31 @@
 <?php
 /**
- * Catalog attributes configuration data container. Provides catalog attributes configuration data.
- *
  * Copyright © 2016 Magento. All rights reserved.
  * See COPYING.txt for license details.
  */
 namespace Magento\Catalog\Model\Attribute\Config;
 
+use Magento\Framework\Serialize\SerializerInterface;
+
 class Data extends \Magento\Framework\Config\Data
 {
+    /**
+     * Cache identifier
+     */
+    const CACHE_ID = 'catalog_attributes';
+
     /**
      * @param \Magento\Catalog\Model\Attribute\Config\Reader $reader
      * @param \Magento\Framework\Config\CacheInterface $cache
+     * @param string|null $cacheId
+     * @param SerializerInterface|null $serializer
      */
     public function __construct(
         \Magento\Catalog\Model\Attribute\Config\Reader $reader,
-        \Magento\Framework\Config\CacheInterface $cache
+        \Magento\Framework\Config\CacheInterface $cache,
+        $cacheId = 'eav_attributes',
+        SerializerInterface $serializer = null
     ) {
-        parent::__construct($reader, $cache, 'catalog_attributes');
+        parent::__construct($reader, $cache, $cacheId, $serializer);
     }
 }
diff --git a/app/code/Magento/Catalog/Model/ProductOptions/Config.php b/app/code/Magento/Catalog/Model/ProductOptions/Config.php
index bd55304e03b..f78eb0e4f50 100644
--- a/app/code/Magento/Catalog/Model/ProductOptions/Config.php
+++ b/app/code/Magento/Catalog/Model/ProductOptions/Config.php
@@ -5,20 +5,24 @@
  */
 namespace Magento\Catalog\Model\ProductOptions;
 
+use Magento\Framework\Serialize\SerializerInterface;
+
 class Config extends \Magento\Framework\Config\Data implements
     \Magento\Catalog\Model\ProductOptions\ConfigInterface
 {
     /**
      * @param \Magento\Catalog\Model\ProductOptions\Config\Reader $reader
      * @param \Magento\Framework\Config\CacheInterface $cache
-     * @param string $cacheId
+     * @param string|null $cacheId
+     * @param SerializerInterface|null $serializer
      */
     public function __construct(
         \Magento\Catalog\Model\ProductOptions\Config\Reader $reader,
         \Magento\Framework\Config\CacheInterface $cache,
-        $cacheId = 'product_options_config'
+        $cacheId = 'product_options_config',
+        SerializerInterface $serializer = null
     ) {
-        parent::__construct($reader, $cache, $cacheId);
+        parent::__construct($reader, $cache, $cacheId, $serializer);
     }
 
     /**
diff --git a/app/code/Magento/Cron/Model/Groups/Config/Data.php b/app/code/Magento/Cron/Model/Groups/Config/Data.php
index 29b70b90195..2f400c642ed 100644
--- a/app/code/Magento/Cron/Model/Groups/Config/Data.php
+++ b/app/code/Magento/Cron/Model/Groups/Config/Data.php
@@ -3,25 +3,28 @@
  * Copyright © 2016 Magento. All rights reserved.
  * See COPYING.txt for license details.
  */
+namespace Magento\Cron\Model\Groups\Config;
+
+use Magento\Framework\Serialize\SerializerInterface;
 
 /**
  * Prepare cron jobs data
  */
-namespace Magento\Cron\Model\Groups\Config;
-
 class Data extends \Magento\Framework\Config\Data
 {
     /**
      * @param \Magento\Cron\Model\Groups\Config\Reader\Xml $reader
      * @param \Magento\Framework\Config\CacheInterface $cache
-     * @param string $cacheId
+     * @param string|null $cacheId
+     * @param SerializerInterface|null $serializer
      */
     public function __construct(
         \Magento\Cron\Model\Groups\Config\Reader\Xml $reader,
         \Magento\Framework\Config\CacheInterface $cache,
-        $cacheId = 'cron_groups_config_cache'
+        $cacheId = 'cron_groups_config_cache',
+        SerializerInterface $serializer = null
     ) {
-        parent::__construct($reader, $cache, $cacheId);
+        parent::__construct($reader, $cache, $cacheId, $serializer);
     }
 
     /**
diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Config.php b/app/code/Magento/Eav/Model/Entity/Attribute/Config.php
index 9dbba7c5bac..d7c5edd8485 100644
--- a/app/code/Magento/Eav/Model/Entity/Attribute/Config.php
+++ b/app/code/Magento/Eav/Model/Entity/Attribute/Config.php
@@ -10,17 +10,15 @@ use Magento\Framework\Serialize\SerializerInterface;
 class Config extends \Magento\Framework\Config\Data
 {
     /**
-     * Config constructor
-     *
      * @param Config\Reader $reader
      * @param \Magento\Framework\Config\CacheInterface $cache
-     * @param string $cacheId
-     * @param SerializerInterface $serializer
+     * @param string|null $cacheId
+     * @param SerializerInterface|null $serializer
      */
     public function __construct(
         \Magento\Eav\Model\Entity\Attribute\Config\Reader $reader,
         \Magento\Framework\Config\CacheInterface $cache,
-        $cacheId = "eav_attributes",
+        $cacheId = 'eav_attributes',
         SerializerInterface $serializer = null
     ) {
         parent::__construct($reader, $cache, $cacheId, $serializer);
diff --git a/app/code/Magento/Email/Model/Template/Config/Data.php b/app/code/Magento/Email/Model/Template/Config/Data.php
index c7f4054bf31..182cd276771 100644
--- a/app/code/Magento/Email/Model/Template/Config/Data.php
+++ b/app/code/Magento/Email/Model/Template/Config/Data.php
@@ -1,22 +1,31 @@
 <?php
 /**
- * Email templates configuration data container. Provides email templates configuration data.
- *
  * Copyright © 2016 Magento. All rights reserved.
  * See COPYING.txt for license details.
  */
 namespace Magento\Email\Model\Template\Config;
 
+use Magento\Framework\Serialize\SerializerInterface;
+
 class Data extends \Magento\Framework\Config\Data
 {
+    /**
+     * Cache identifier
+     */
+    const CACHE_ID = 'email_templates';
+
     /**
      * @param \Magento\Email\Model\Template\Config\Reader $reader
      * @param \Magento\Framework\Config\CacheInterface $cache
+     * @param string|null $cacheId
+     * @param SerializerInterface|null $serializer
      */
     public function __construct(
         \Magento\Email\Model\Template\Config\Reader $reader,
-        \Magento\Framework\Config\CacheInterface $cache
+        \Magento\Framework\Config\CacheInterface $cache,
+        $cacheId = self::CACHE_ID,
+        SerializerInterface $serializer = null
     ) {
-        parent::__construct($reader, $cache, 'email_templates');
+        parent::__construct($reader, $cache, $cacheId, $serializer);
     }
 }
diff --git a/app/code/Magento/Search/Model/SearchEngine/Config/Data.php b/app/code/Magento/Search/Model/SearchEngine/Config/Data.php
index 18a3b620eee..213a92958ac 100644
--- a/app/code/Magento/Search/Model/SearchEngine/Config/Data.php
+++ b/app/code/Magento/Search/Model/SearchEngine/Config/Data.php
@@ -5,20 +5,22 @@
  */
 namespace Magento\Search\Model\SearchEngine\Config;
 
+use Magento\Framework\Serialize\SerializerInterface;
+
 class Data extends \Magento\Framework\Config\Data
 {
     /**
-     * Constructor
-     *
      * @param \Magento\Framework\Search\SearchEngine\Config\Reader $reader
      * @param \Magento\Framework\Config\CacheInterface $cache
-     * @param string $cacheId
+     * @param string|null $cacheId
+     * @param SerializerInterface|null $serializer
      */
     public function __construct(
         \Magento\Framework\Search\SearchEngine\Config\Reader $reader,
         \Magento\Framework\Config\CacheInterface $cache,
-        $cacheId = 'search_engine_config_cache'
+        $cacheId = 'search_engine_config_cache',
+        SerializerInterface $serializer = null
     ) {
-        parent::__construct($reader, $cache, $cacheId);
+        parent::__construct($reader, $cache, $cacheId, $serializer);
     }
 }
diff --git a/lib/internal/Magento/Framework/Api/ExtensionAttribute/Config.php b/lib/internal/Magento/Framework/Api/ExtensionAttribute/Config.php
index 303e4a57926..3c5dd0bf415 100644
--- a/lib/internal/Magento/Framework/Api/ExtensionAttribute/Config.php
+++ b/lib/internal/Magento/Framework/Api/ExtensionAttribute/Config.php
@@ -7,6 +7,7 @@ namespace Magento\Framework\Api\ExtensionAttribute;
 
 use Magento\Framework\Config\CacheInterface;
 use Magento\Framework\Api\ExtensionAttribute\Config\Reader;
+use Magento\Framework\Serialize\SerializerInterface;
 
 /**
  * Extension attributes config
@@ -16,15 +17,17 @@ class Config extends \Magento\Framework\Config\Data
     const CACHE_ID = 'extension_attributes_config';
 
     /**
-     * Initialize reader and cache.
-     *
      * @param Reader $reader
      * @param CacheInterface $cache
+     * @param string $cacheId|null
+     * @param SerializerInterface|null $serializer
      */
     public function __construct(
         Reader $reader,
-        CacheInterface $cache
+        CacheInterface $cache,
+        $cacheId = self::CACHE_ID,
+        SerializerInterface $serializer = null
     ) {
-        parent::__construct($reader, $cache, self::CACHE_ID);
+        parent::__construct($reader, $cache, $cacheId, $serializer);
     }
 }
diff --git a/lib/internal/Magento/Framework/App/ResourceConnection/Config.php b/lib/internal/Magento/Framework/App/ResourceConnection/Config.php
index 9cd03c8372e..c6b186e05a3 100644
--- a/lib/internal/Magento/Framework/App/ResourceConnection/Config.php
+++ b/lib/internal/Magento/Framework/App/ResourceConnection/Config.php
@@ -1,7 +1,5 @@
 <?php
 /**
- * Resource configuration. Uses application configuration to retrieve resource connection information.
- *
  * Copyright © 2016 Magento. All rights reserved.
  * See COPYING.txt for license details.
  */
@@ -9,6 +7,9 @@ namespace Magento\Framework\App\ResourceConnection;
 
 use Magento\Framework\Config\ConfigOptionsListConstants;
 
+/**
+ * Resource configuration, uses application configuration to retrieve resource connection information
+ */
 class Config extends \Magento\Framework\Config\Data\Scoped implements ConfigInterface
 {
     /**
diff --git a/lib/internal/Magento/Framework/Communication/Config/Data.php b/lib/internal/Magento/Framework/Communication/Config/Data.php
index e073c7c5471..69f86fdcea7 100644
--- a/lib/internal/Magento/Framework/Communication/Config/Data.php
+++ b/lib/internal/Magento/Framework/Communication/Config/Data.php
@@ -5,23 +5,27 @@
  */
 namespace Magento\Framework\Communication\Config;
 
-/**
- * Communication config data.
- */
+use Magento\Framework\Serialize\SerializerInterface;
+
 class Data extends \Magento\Framework\Config\Data
 {
     /**
-     * Initialize dependencies.
-     *
+     * Cache identifier
+     */
+    const CACHE_ID = 'communication_config_cache';
+
+    /**
      * @param \Magento\Framework\Communication\Config\CompositeReader $reader
      * @param \Magento\Framework\Config\CacheInterface $cache
-     * @param string $cacheId
+     * @param string|null $cacheId
+     * @param SerializerInterface|null $serializer
      */
     public function __construct(
         \Magento\Framework\Communication\Config\CompositeReader $reader,
         \Magento\Framework\Config\CacheInterface $cache,
-        $cacheId = 'communication_config_cache'
+        $cacheId = self::CACHE_ID,
+        SerializerInterface $serializer = null
     ) {
-        parent::__construct($reader, $cache, $cacheId);
+        parent::__construct($reader, $cache, $cacheId, $serializer);
     }
 }
diff --git a/lib/internal/Magento/Framework/Search/Request/Config.php b/lib/internal/Magento/Framework/Search/Request/Config.php
index b348f214dd4..4793c4b51c4 100644
--- a/lib/internal/Magento/Framework/Search/Request/Config.php
+++ b/lib/internal/Magento/Framework/Search/Request/Config.php
@@ -5,21 +5,27 @@
  */
 namespace Magento\Framework\Search\Request;
 
+use Magento\Framework\Serialize\SerializerInterface;
+
 class Config extends \Magento\Framework\Config\Data
 {
-    /** Cache ID for Search Request*/
+    /**
+     * Cache identifier
+     */
     const CACHE_ID = 'request_declaration';
 
     /**
      * @param \Magento\Framework\Search\Request\Config\FilesystemReader $reader
      * @param \Magento\Framework\Config\CacheInterface $cache
-     * @param string $cacheId
+     * @param string|null $cacheId
+     * @param SerializerInterface|null $serializer
      */
     public function __construct(
         \Magento\Framework\Search\Request\Config\FilesystemReader $reader,
         \Magento\Framework\Config\CacheInterface $cache,
-        $cacheId = self::CACHE_ID
+        $cacheId = self::CACHE_ID,
+        SerializerInterface $serializer = null
     ) {
-        parent::__construct($reader, $cache, $cacheId);
+        parent::__construct($reader, $cache, $cacheId, $serializer);
     }
 }
diff --git a/setup/src/Magento/Setup/Module/Di/Code/Generator/PluginList.php b/setup/src/Magento/Setup/Module/Di/Code/Generator/PluginList.php
index 703cbced8e3..5853ae8a51c 100644
--- a/setup/src/Magento/Setup/Module/Di/Code/Generator/PluginList.php
+++ b/setup/src/Magento/Setup/Module/Di/Code/Generator/PluginList.php
@@ -1,10 +1,8 @@
 <?php
 /**
- *
  * Copyright © 2016 Magento. All rights reserved.
  * See COPYING.txt for license details.
  */
-
 namespace Magento\Setup\Module\Di\Code\Generator;
 
 use Magento\Framework\Interception;
-- 
GitLab