Repository: prettier/plugin-php
Pull request #650 (2018-09-19 15:58:25)

Test bin
Just tests

czosel: By the way: Shall we release a `0.7.0`? Quite a few changes landed since `0.6.0`.
evilebottnawi: @czosel yep, today i will do it, right now do refactor some stuff and more tests
czosel: @evilebottnawi Awesome! :+1: 

Patch:
diff --git a/src/printer.js b/src/printer.js
index 99d6395..e7c1c52 100644
--- a/src/printer.js
+++ b/src/printer.js
@@ -2376,7 +2376,7 @@ function printNode(path, options, print) {
       //     a &&
       //     b &&
       //     c
-      //   ).call()
+      //   )->call()
       if (
         parent.kind === "unary" ||
         (isLookupNode(parent) && parent.kind !== "offsetlookup")


Test patch:
diff --git a/tests/bin/__snapshots__/jsfmt.spec.js.snap b/tests/bin/__snapshots__/jsfmt.spec.js.snap
index cbcb71a..bd7442e 100644
--- a/tests/bin/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/bin/__snapshots__/jsfmt.spec.js.snap
@@ -191,6 +191,42 @@ $accelerator =
 
         )
     );
+
+~($a || $b);
+~($someReallyReallyReallyLongBooleanVariable || $someOtherReallyReallyReallyLongBooleanVariable);
+
+($a || $b).foo;
+($someReallyReallyReallyLongBooleanVariable || $someOtherReallyReallyReallyLongBooleanVariable)->foo;
+
+($a || $b).foo();
+($someReallyReallyReallyLongBooleanVariable || $someOtherReallyReallyReallyLongBooleanVariable)->foo();
+
+($a || $b)::foo();
+($someReallyReallyReallyLongBooleanVariable || $someOtherReallyReallyReallyLongBooleanVariable)::foo();
+
+($a || $b)['string'];
+($someReallyReallyReallyLongBooleanVariable || $someReallyReallyReallyLongBooleanVariable)['string'];
+
+$var = call($var > $var ? true : false);
+$var = call($someOtherReallyReallyLongVariable > $var ? true : false);
+$var = call($var > $someOtherReallyReallyLongVariable ? true : false);
+$var = call($someOtherReallyReallyLongVariable > $someOtherReallyReallyLongVariable ? true : false);
+$var = call($someOtherReallyReallyReallyReallyReallyReallyLongVariable > $someOtherReallyReallyReallyReallyReallyReallyLongVariable ? true : false);
+
+return $var > $var ? true : false;
+return $someOtherReallyReallyLongVariable > $var ? true : false;
+return $var > $someOtherReallyReallyLongVariable ? true : false;
+return $someOtherReallyReallyLongVariable > $someOtherReallyReallyLongVariable ? true : false;
+return $someOtherReallyReallyReallyReallyReallyReallyLongVariable > $someOtherReallyReallyReallyReallyReallyReallyLongVariable ? true : false;
+
+fn(
+    $bifornCringerMoshedPerplexSawder,
+    $askTrovenaBeenaDependsRowans,
+    $glimseGlyphsHazardNoopsTieTie === averredBathersBoxroomBuggyNurl &&
+    $anodyneCondosMalateOverateRetinol
+        ? $annularCooeedSplicesWalksWayWay
+        : $kochabCooieGameOnOboleUnweave
+);
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 <?php
 $a++;
@@ -477,6 +513,69 @@ $accelerator =
     (extension_loaded('xcache') && ini_get('xcache.cacher')) ||
     (extension_loaded('wincache') && ini_get('wincache.ocenabled'));
 
+~($a || $b);
+~(
+    $someReallyReallyReallyLongBooleanVariable ||
+    $someOtherReallyReallyReallyLongBooleanVariable
+);
+
+($a || $b) . foo;
+(
+    $someReallyReallyReallyLongBooleanVariable ||
+    $someOtherReallyReallyReallyLongBooleanVariable
+)->foo;
+
+($a || $b) . foo();
+(
+    $someReallyReallyReallyLongBooleanVariable ||
+    $someOtherReallyReallyReallyLongBooleanVariable
+)->foo();
+
+($a || $b)::foo();
+(
+    $someReallyReallyReallyLongBooleanVariable ||
+    $someOtherReallyReallyReallyLongBooleanVariable
+)::foo();
+
+($a || $b)['string'];
+($someReallyReallyReallyLongBooleanVariable ||
+    $someReallyReallyReallyLongBooleanVariable)['string'];
+
+$var = call($var > $var ? true : false);
+$var = call($someOtherReallyReallyLongVariable > $var ? true : false);
+$var = call($var > $someOtherReallyReallyLongVariable ? true : false);
+$var = call(
+    $someOtherReallyReallyLongVariable > $someOtherReallyReallyLongVariable
+        ? true
+        : false
+);
+$var = call(
+    $someOtherReallyReallyReallyReallyReallyReallyLongVariable >
+    $someOtherReallyReallyReallyReallyReallyReallyLongVariable
+        ? true
+        : false
+);
+
+return $var > $var ? true : false;
+return $someOtherReallyReallyLongVariable > $var ? true : false;
+return $var > $someOtherReallyReallyLongVariable ? true : false;
+return $someOtherReallyReallyLongVariable > $someOtherReallyReallyLongVariable
+    ? true
+    : false;
+return $someOtherReallyReallyReallyReallyReallyReallyLongVariable >
+    $someOtherReallyReallyReallyReallyReallyReallyLongVariable
+    ? true
+    : false;
+
+fn(
+    $bifornCringerMoshedPerplexSawder,
+    $askTrovenaBeenaDependsRowans,
+    $glimseGlyphsHazardNoopsTieTie === averredBathersBoxroomBuggyNurl &&
+    $anodyneCondosMalateOverateRetinol
+        ? $annularCooeedSplicesWalksWayWay
+        : $kochabCooieGameOnOboleUnweave
+);
+
 `;
 
 exports[`single.php - php-verify: single.php 1`] = `
diff --git a/tests/bin/bin.php b/tests/bin/bin.php
index 598589c..6af04ee 100644
--- a/tests/bin/bin.php
+++ b/tests/bin/bin.php
@@ -188,3 +188,39 @@ $accelerator =
 
         )
     );
+
+~($a || $b);
+~($someReallyReallyReallyLongBooleanVariable || $someOtherReallyReallyReallyLongBooleanVariable);
+
+($a || $b).foo;
+($someReallyReallyReallyLongBooleanVariable || $someOtherReallyReallyReallyLongBooleanVariable)->foo;
+
+($a || $b).foo();
+($someReallyReallyReallyLongBooleanVariable || $someOtherReallyReallyReallyLongBooleanVariable)->foo();
+
+($a || $b)::foo();
+($someReallyReallyReallyLongBooleanVariable || $someOtherReallyReallyReallyLongBooleanVariable)::foo();
+
+($a || $b)['string'];
+($someReallyReallyReallyLongBooleanVariable || $someReallyReallyReallyLongBooleanVariable)['string'];
+
+$var = call($var > $var ? true : false);
+$var = call($someOtherReallyReallyLongVariable > $var ? true : false);
+$var = call($var > $someOtherReallyReallyLongVariable ? true : false);
+$var = call($someOtherReallyReallyLongVariable > $someOtherReallyReallyLongVariable ? true : false);
+$var = call($someOtherReallyReallyReallyReallyReallyReallyLongVariable > $someOtherReallyReallyReallyReallyReallyReallyLongVariable ? true : false);
+
+return $var > $var ? true : false;
+return $someOtherReallyReallyLongVariable > $var ? true : false;
+return $var > $someOtherReallyReallyLongVariable ? true : false;
+return $someOtherReallyReallyLongVariable > $someOtherReallyReallyLongVariable ? true : false;
+return $someOtherReallyReallyReallyReallyReallyReallyLongVariable > $someOtherReallyReallyReallyReallyReallyReallyLongVariable ? true : false;
+
+fn(
+    $bifornCringerMoshedPerplexSawder,
+    $askTrovenaBeenaDependsRowans,
+    $glimseGlyphsHazardNoopsTieTie === averredBathersBoxroomBuggyNurl &&
+    $anodyneCondosMalateOverateRetinol
+        ? $annularCooeedSplicesWalksWayWay
+        : $kochabCooieGameOnOboleUnweave
+);