From 8755dc900af56c208d18e7641b51692da064db3f Mon Sep 17 00:00:00 2001
From: Oleksandr Shmyheliuk <oshmyheliuk@magento.com>
Date: Tue, 10 Jan 2017 15:27:23 +0200
Subject: [PATCH] MAGETWO-62705: Implementation

---
 app/code/Magento/Deploy/Model/ConfigWriter.php      |  2 +-
 .../App/DeploymentConfig/Writer/PhpFormatter.php    |  4 +++-
 .../DeploymentConfig/Writer/PhpFormatterTest.php    | 13 ++++++-------
 3 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/app/code/Magento/Deploy/Model/ConfigWriter.php b/app/code/Magento/Deploy/Model/ConfigWriter.php
index d329083f1ee..7a9b70c528a 100644
--- a/app/code/Magento/Deploy/Model/ConfigWriter.php
+++ b/app/code/Magento/Deploy/Model/ConfigWriter.php
@@ -46,7 +46,7 @@ class ConfigWriter
      * @param string|null $scopeCode
      * @return void
      */
-    public function save(array $values, $scope = 'default', $scopeCode = null)
+    public function save(array $values, $scope = ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $scopeCode = null)
     {
         $config = [];
         $pathPrefix = $this->getPathPrefix($scope, $scopeCode);
diff --git a/lib/internal/Magento/Framework/App/DeploymentConfig/Writer/PhpFormatter.php b/lib/internal/Magento/Framework/App/DeploymentConfig/Writer/PhpFormatter.php
index 5b551b5c6f0..28fcbd3692c 100644
--- a/lib/internal/Magento/Framework/App/DeploymentConfig/Writer/PhpFormatter.php
+++ b/lib/internal/Magento/Framework/App/DeploymentConfig/Writer/PhpFormatter.php
@@ -25,7 +25,9 @@ class PhpFormatter implements FormatterInterface
             foreach ($data as $key => $value) {
                 $comment = '  ';
                 if (!empty($comments[$key])) {
-                    $exportedComment = trim(var_export($comments[$key], true), '\'');
+                    $exportedComment = is_string($comments[$key])
+                        ? $comments[$key]
+                        : var_export($comments[$key], true);
                     $comment = "  /**\n * " . str_replace("\n", "\n * ", $exportedComment) . "\n */\n";
                 }
                 $space = is_array($value) ? " \n" : ' ';
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/Writer/PhpFormatterTest.php b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/Writer/PhpFormatterTest.php
index e69ae1475a3..9f6894c0a68 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/Writer/PhpFormatterTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/Writer/PhpFormatterTest.php
@@ -3,7 +3,6 @@
  * Copyright © 2013-2017 Magento, Inc. All rights reserved.
  * See COPYING.txt for license details.
  */
-
 namespace Magento\Framework\App\Test\Unit\DeploymentConfig\Writer;
 
 use \Magento\Framework\App\DeploymentConfig\Writer\PhpFormatter;
@@ -48,9 +47,9 @@ class PhpFormatterTest extends \PHPUnit_Framework_TestCase
         ];
         $comments1 = ['ns2' => 'comment for namespace 2'];
         $comments2 = [
-            'ns1' => 'comment for namespace 1',
-            'ns2' => "comment for namespace 2.\nNext comment for namespace 2",
-            'ns3' => 'comment for namespace 3',
+            'ns1' => 'comment for\' namespace 1',
+            'ns2' => "comment for namespace 2.\nNext comment for' namespace 2",
+            'ns3' => 'comment for" namespace 3',
             'ns4' => 'comment for namespace 4',
             'ns5' => 'comment for unexisted namespace 5',
         ];
@@ -89,7 +88,7 @@ TEXT;
 <?php
 return array (
   /**
-   * comment for namespace 1
+   * comment for' namespace 1
    */
   'ns1' => 
   array (
@@ -106,7 +105,7 @@ return array (
   ),
   /**
    * comment for namespace 2.
-   * Next comment for namespace 2
+   * Next comment for' namespace 2
    */
   'ns2' => 
   array (
@@ -116,7 +115,7 @@ return array (
     ),
   ),
   /**
-   * comment for namespace 3
+   * comment for" namespace 3
    */
   'ns3' => 'just text',
   /**
-- 
GitLab