diff --git a/app/code/Magento/Deploy/Model/ConfigWriter.php b/app/code/Magento/Deploy/Model/ConfigWriter.php
index d329083f1eea5b9cd5aa68c06f162d6e5a91b786..7a9b70c528ac9e5d9010e0683b651823ecb74c4a 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 5b551b5c6f01ee2c9e95f745d347f65e67e0bb6d..28fcbd3692c9e1dffb84b0a2ef98b1ffb0633d96 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 e69ae1475a3bc9839744d07b888be58d9685b7f9..9f6894c0a68350e86b9e96a8111de123ac11d574 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',
   /**