Repository: prettier/plugin-php
Pull request #875 (2019-01-18 11:23:47)

test: multiple classconstant
Just tests


Patch:
diff --git a/src/clean.js b/src/clean.js
index 3ed8f9a..19ae0b7 100644
--- a/src/clean.js
+++ b/src/clean.js
@@ -58,31 +58,6 @@ function clean(node, newObj) {
     newObj.value = util.printNumber(node.value);
   }
 
-  // All magic constant should be upper case
-  if (node.kind === "magic") {
-    newObj.value = node.value.toUpperCase();
-  }
-
-  // All reserved words should be lowercase case
-  if (node.kind === "identifier" && typeof node.name === "string") {
-    const lowerCasedName = node.name.toLowerCase();
-    const isLowerCase =
-      [
-        "int",
-        "float",
-        "bool",
-        "string",
-        "null",
-        "void",
-        "iterable",
-        "object",
-        "self",
-        "parent"
-      ].indexOf(lowerCasedName) !== -1;
-
-    newObj.name = isLowerCase ? lowerCasedName : node.name;
-  }
-
   const statements = ["foreach", "for", "if", "while", "do"];
 
   if (statements.includes(node.kind)) {


Test patch:
diff --git a/tests/classconstant/__snapshots__/jsfmt.spec.js.snap b/tests/classconstant/__snapshots__/jsfmt.spec.js.snap
index 17b5b88..c168ee8 100644
--- a/tests/classconstant/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/classconstant/__snapshots__/jsfmt.spec.js.snap
@@ -43,6 +43,12 @@ EOD;
     const CONST_12 = ['value', 'other-value', 'other-other-value', 'other-other-other-value'];
     const CONST_13 = ['key' => 'value', 'other-key' => 'other-value'];
     const CONST_14 = ['key' => 'value', 'other-key' => 'other-value', 'other-other-key' => 'other-other-value'];
+
+    const FIRST = "Hello", SECOND = "world", THIRD = "!";
+    const VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_FIRST = "Hello", SECOND_1 = "world", THIRD_1 = "!";
+    const FIRST_1 = "Hello", VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_SECOND = "world", THIRD_2 = "!";
+    const VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_FIRST_FIRST = "Hello", VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_SECOND_1 = "world", VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_FIRST_THIRD = "!";
+    const CONST_15 = ['key' => 'value', 'other-key' => 'other-value', 'other-other-key' => 'other-other-value'], FOO_BAR = "test", BAR_FOOR = ['value', 'other-value'];
 }
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 <?php
@@ -119,6 +125,24 @@ EOD;
         'other-key' => 'other-value',
         'other-other-key' => 'other-other-value'
     ];
+
+    const FIRST = "Hello", SECOND = "world", THIRD = "!";
+    const VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_FIRST = "Hello",
+        SECOND_1 = "world",
+        THIRD_1 = "!";
+    const FIRST_1 = "Hello",
+        VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_SECOND = "world",
+        THIRD_2 = "!";
+    const VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_FIRST_FIRST = "Hello",
+        VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_SECOND_1 = "world",
+        VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_FIRST_THIRD = "!";
+    const CONST_15 = [
+            'key' => 'value',
+            'other-key' => 'other-value',
+            'other-other-key' => 'other-other-value'
+        ],
+        FOO_BAR = "test",
+        BAR_FOOR = ['value', 'other-value'];
 }
 
 `;
diff --git a/tests/classconstant/classconstant.php b/tests/classconstant/classconstant.php
index 16d8b91..bd2910f 100644
--- a/tests/classconstant/classconstant.php
+++ b/tests/classconstant/classconstant.php
@@ -40,4 +40,10 @@ EOD;
     const CONST_12 = ['value', 'other-value', 'other-other-value', 'other-other-other-value'];
     const CONST_13 = ['key' => 'value', 'other-key' => 'other-value'];
     const CONST_14 = ['key' => 'value', 'other-key' => 'other-value', 'other-other-key' => 'other-other-value'];
+
+    const FIRST = "Hello", SECOND = "world", THIRD = "!";
+    const VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_FIRST = "Hello", SECOND_1 = "world", THIRD_1 = "!";
+    const FIRST_1 = "Hello", VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_SECOND = "world", THIRD_2 = "!";
+    const VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_FIRST_FIRST = "Hello", VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_SECOND_1 = "world", VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_FIRST_THIRD = "!";
+    const CONST_15 = ['key' => 'value', 'other-key' => 'other-value', 'other-other-key' => 'other-other-value'], FOO_BAR = "test", BAR_FOOR = ['value', 'other-value'];
 }
diff --git a/tests/constant/__snapshots__/jsfmt.spec.js.snap b/tests/constant/__snapshots__/jsfmt.spec.js.snap
index 430ffcf..0516b95 100644
--- a/tests/constant/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/constant/__snapshots__/jsfmt.spec.js.snap
@@ -10,6 +10,11 @@ const TWO = ONE * 2;
 
 $test = TEST_CONSTANT;
 $test = OTHER_TEST_CONSTANT;
+
+const FIRST = "Hello", SECOND = "world", THIRD = "!";
+const VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_FIRST = "Hello", SECOND = "world", THIRD = "!";
+const FIRST = "Hello", VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_SECOND = "world", THIRD = "!";
+const VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_FIRST_FIRST = "Hello", VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_SECOND = "world", VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_FIRST_THIRD = "!";
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 <?php
 define("TEST_CONSTANT", 1);
@@ -21,4 +26,15 @@ const TWO = ONE * 2;
 $test = TEST_CONSTANT;
 $test = OTHER_TEST_CONSTANT;
 
+const FIRST = "Hello", SECOND = "world", THIRD = "!";
+const VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_FIRST = "Hello",
+    SECOND = "world",
+    THIRD = "!";
+const FIRST = "Hello",
+    VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_SECOND = "world",
+    THIRD = "!";
+const VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_FIRST_FIRST = "Hello",
+    VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_SECOND = "world",
+    VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_FIRST_THIRD = "!";
+
 `;
diff --git a/tests/constant/constants.php b/tests/constant/constants.php
index e675b32..4c60633 100644
--- a/tests/constant/constants.php
+++ b/tests/constant/constants.php
@@ -7,3 +7,8 @@ const TWO = ONE * 2;
 
 $test = TEST_CONSTANT;
 $test = OTHER_TEST_CONSTANT;
+
+const FIRST = "Hello", SECOND = "world", THIRD = "!";
+const VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_FIRST = "Hello", SECOND = "world", THIRD = "!";
+const FIRST = "Hello", VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_SECOND = "world", THIRD = "!";
+const VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_FIRST_FIRST = "Hello", VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_SECOND = "world", VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_FIRST_THIRD = "!";