Repository: prettier/plugin-php
Pull request #162 (2018-03-06 10:58:03)

tests: multiple statements per line
Just tests. From PSR:
> There MUST NOT be more than one statement per line.


Patch:
diff --git a/src/printer.js b/src/printer.js
index dc3cf16..2eaa7ab 100644
--- a/src/printer.js
+++ b/src/printer.js
@@ -836,8 +836,7 @@ function printStatement(path, options, print) {
         group(
           concat([
             "while (",
-            softline,
-            path.call(print, "test"),
+            indent(concat([softline, path.call(print, "test")])),
             softline,
             concat([")", node.shortForm ? ":" : " {"])
           ])


Test patch:
diff --git a/tests/call/__snapshots__/jsfmt.spec.js.snap b/tests/call/__snapshots__/jsfmt.spec.js.snap
index 99499d0..f8e5514 100644
--- a/tests/call/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/call/__snapshots__/jsfmt.spec.js.snap
@@ -7,6 +7,91 @@ func($a, $b, $c);
 func(...$a);
 func($a, ...$b);
 $foo->func();
+
+$db->Execute($sql, [
+    $foo,
+    $bar,
+    $foobar,
+    $somewhatLongParameter,
+    $somewhatLongParameterX,
+    $somewhatLongParameterXYZ
+]);
+
+$db->Execute([
+    $foo,
+    $bar,
+    $foobar,
+    $somewhatLongParameter,
+    $somewhatLongParameterX,
+    $somewhatLongParameterXYZ
+], $sql);
+
+$app->get('/hello/{name}', function ($name) use ($app) {
+    return 'Hello ' . $app->escape($name);
+});
+
+$this->something->method($argument, $this->more->stuff(
+    $this->even->more->things->complicatedMethod()
+));
+
+$this->something->method(
+    $this->more->stuff($this->even->more->things->complicatedMethod()),
+    $argument
+);
+
+$this->something->method(
+    $argument,
+    $otherArgument,
+    array("foo" => "bar", "baz" => "buzz"),
+    $this->even->more->things->complicatedMethod()
+);
+
+$this->files->put(
+    $path, $this->expiration($minutes).serialize($value), true
+);
+
+tap(((int) $raw['data']) + $value, function ($newValue) use ($key, $raw) {
+    $this->put($key, $newValue, $raw['time']);
+});
+
+$expire = substr(
+    $contents = $this->files->get($path, true), 0, 10
+);
+$this->app->singleton('session', function ($app) {
+    return new SessionManager($app);
+});
+
+$this->filter([
+    new MergeValue(['First', 'Second']),
+    'Taylor',
+    'Mohamed',
+    $this->mergeWhen(false, ['Adam', 'Matt']),
+    'Jeffrey',
+    new MergeValue(['Abigail', 'Lydia']),
+]);
+
+$this->assertEquals([
+    'First', 'Second', 'Taylor', 'Mohamed', 'Jeffrey', 'Abigail', 'Lydia',
+], $results);
+
+$this->assertEquals(['First'], $results);
+
+$some->other->thing(array(
+    'foo' => 'bar',
+    'buzz' => $this->is->nested(array(
+        'complex' => 'stuff',
+        'foo' => 'bar',
+        'buzz' => 'bazz'
+    ))
+));
+
+$some->other->thing(array(
+    'foo' => 'bar',
+    'buzz' => $this->is->nested(array(12, 34, 45, 67, 89))
+), array(
+    11323123,
+    1231, 13231233243, 324234234
+));
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 <?php
 func();
@@ -15,4 +100,92 @@ func(...$a);
 func($a, ...$b);
 $foo->func();
 
+$db->Execute($sql, [
+    $foo,
+    $bar,
+    $foobar,
+    $somewhatLongParameter,
+    $somewhatLongParameterX,
+    $somewhatLongParameterXYZ
+]);
+
+$db->Execute([
+    $foo,
+    $bar,
+    $foobar,
+    $somewhatLongParameter,
+    $somewhatLongParameterX,
+    $somewhatLongParameterXYZ
+], $sql);
+
+$app->get('/hello/{name}', function ($name) use ($app) {
+    return 'Hello ' . $app->escape($name);
+});
+
+$this->something->method(
+    $argument,
+    $this->more->stuff($this->even->more->things->complicatedMethod())
+);
+
+$this->something->method(
+    $this->more->stuff($this->even->more->things->complicatedMethod()),
+    $argument
+);
+
+$this->something->method(
+    $argument,
+    $otherArgument,
+    array("foo" => "bar", "baz" => "buzz"),
+    $this->even->more->things->complicatedMethod()
+);
+
+$this->files->put($path, $this->expiration($minutes) . serialize($value), true);
+
+tap(((int) $raw['data']) + $value, function ($newValue) use ($key, $raw) {
+    $this->put($key, $newValue, $raw['time']);
+});
+
+$expire = substr($contents = $this->files->get($path, true), 0, 10);
+$this->app->singleton('session', function ($app) {
+    return new SessionManager($app);
+});
+
+$this->filter([
+    new MergeValue(['First', 'Second']),
+    'Taylor',
+    'Mohamed',
+    $this->mergeWhen(false, ['Adam', 'Matt']),
+    'Jeffrey',
+    new MergeValue(['Abigail', 'Lydia'])
+]);
+
+$this->assertEquals([
+    'First',
+    'Second',
+    'Taylor',
+    'Mohamed',
+    'Jeffrey',
+    'Abigail',
+    'Lydia'
+], $results);
+
+$this->assertEquals(['First'], $results);
+
+$some->other->thing(array(
+    'foo' => 'bar',
+    'buzz' => $this->is->nested(array(
+        'complex' => 'stuff',
+        'foo' => 'bar',
+        'buzz' => 'bazz'
+    ))
+));
+
+$some->other->thing(
+    array(
+        'foo' => 'bar',
+        'buzz' => $this->is->nested(array(12, 34, 45, 67, 89))
+    ),
+    array(11323123, 1231, 13231233243, 324234234)
+);
+
 `;
diff --git a/tests/call/call.php b/tests/call/call.php
index 1b7d6ca..17ce2bd 100644
--- a/tests/call/call.php
+++ b/tests/call/call.php
@@ -4,3 +4,88 @@ func($a, $b, $c);
 func(...$a);
 func($a, ...$b);
 $foo->func();
+
+$db->Execute($sql, [
+    $foo,
+    $bar,
+    $foobar,
+    $somewhatLongParameter,
+    $somewhatLongParameterX,
+    $somewhatLongParameterXYZ
+]);
+
+$db->Execute([
+    $foo,
+    $bar,
+    $foobar,
+    $somewhatLongParameter,
+    $somewhatLongParameterX,
+    $somewhatLongParameterXYZ
+], $sql);
+
+$app->get('/hello/{name}', function ($name) use ($app) {
+    return 'Hello ' . $app->escape($name);
+});
+
+$this->something->method($argument, $this->more->stuff(
+    $this->even->more->things->complicatedMethod()
+));
+
+$this->something->method(
+    $this->more->stuff($this->even->more->things->complicatedMethod()),
+    $argument
+);
+
+$this->something->method(
+    $argument,
+    $otherArgument,
+    array("foo" => "bar", "baz" => "buzz"),
+    $this->even->more->things->complicatedMethod()
+);
+
+$this->files->put(
+    $path, $this->expiration($minutes).serialize($value), true
+);
+
+tap(((int) $raw['data']) + $value, function ($newValue) use ($key, $raw) {
+    $this->put($key, $newValue, $raw['time']);
+});
+
+$expire = substr(
+    $contents = $this->files->get($path, true), 0, 10
+);
+$this->app->singleton('session', function ($app) {
+    return new SessionManager($app);
+});
+
+$this->filter([
+    new MergeValue(['First', 'Second']),
+    'Taylor',
+    'Mohamed',
+    $this->mergeWhen(false, ['Adam', 'Matt']),
+    'Jeffrey',
+    new MergeValue(['Abigail', 'Lydia']),
+]);
+
+$this->assertEquals([
+    'First', 'Second', 'Taylor', 'Mohamed', 'Jeffrey', 'Abigail', 'Lydia',
+], $results);
+
+$this->assertEquals(['First'], $results);
+
+$some->other->thing(array(
+    'foo' => 'bar',
+    'buzz' => $this->is->nested(array(
+        'complex' => 'stuff',
+        'foo' => 'bar',
+        'buzz' => 'bazz'
+    ))
+));
+
+$some->other->thing(array(
+    'foo' => 'bar',
+    'buzz' => $this->is->nested(array(12, 34, 45, 67, 89))
+), array(
+    11323123,
+    1231, 13231233243, 324234234
+));
diff --git a/tests/closure/__snapshots__/jsfmt.spec.js.snap b/tests/closure/__snapshots__/jsfmt.spec.js.snap
new file mode 100644
index 0000000..45d353b
--- /dev/null
+++ b/tests/closure/__snapshots__/jsfmt.spec.js.snap
@@ -0,0 +1,127 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`closure.php 1`] = `
+<?php
+
+$closureWithArgs = function ($arg1, $arg2) {
+    // body
+};
+
+$closureWithArgsAndVars = function ($arg1, $arg2) use ($var1, $var2) {
+    // body
+};
+
+$longArgs_noVars = function (
+    $longArgument,
+    $longerArgument,
+    $muchLongerArgument
+) {
+    // body
+};
+
+$noArgs_longVars = function () use (
+    $longLongLongLongVar1,
+    $longerLongerVar2,
+    $muchLongerVar3
+) {
+    // body
+};
+
+$longArgs_longVars = function (
+    $longArgument,
+    $longerArgument,
+    $muchLongerArgument
+) use (
+    $longLongLongLongLongLongLongVar1,
+    $longerLongerLongerLongerVar2,
+    $muchLongerVar3
+) {
+    // body
+};
+
+$longArgs_shortVars = function (
+    $longArgument,
+    $longerArgument,
+    $muchLongerArgument
+) use ($var1) {
+    // body
+};
+
+$shortArgs_longVars = function ($arg) use (
+    $longVar1,
+    $longerVar2,
+    $muchLongerVar3
+) {
+    // body
+};
+
+$foo->bar(
+    $longLongLongLongLongLongLongLongLongLongArg1,
+    function ($arg2) use ($var1) {
+        // body
+    },
+    $longLongLongLongLongLongLongLongLongLongArg3
+);
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+<?php
+$closureWithArgs = function ($arg1, $arg2) {
+    // body
+};
+
+$closureWithArgsAndVars = function ($arg1, $arg2) use ($var1, $var2) {
+    // body
+};
+
+$longArgs_noVars = function (
+    $longArgument,
+    $longerArgument,
+    $muchLongerArgument
+) {
+    // body
+};
+
+$noArgs_longVars = function () use (
+    $longLongLongLongVar1,
+    $longerLongerVar2,
+    $muchLongerVar3
+) {
+    // body
+};
+
+$longArgs_longVars = function (
+    $longArgument,
+    $longerArgument,
+    $muchLongerArgument
+) use (
+    $longLongLongLongLongLongLongVar1,
+    $longerLongerLongerLongerVar2,
+    $muchLongerVar3
+) {
+    // body
+};
+
+$longArgs_shortVars = function (
+    $longArgument,
+    $longerArgument,
+    $muchLongerArgument
+) use ($var1) {
+    // body
+};
+
+$shortArgs_longVars = function ($arg) use (
+    $longVar1,
+    $longerVar2,
+    $muchLongerVar3
+) {
+    // body
+};
+
+$foo->bar(
+    $longLongLongLongLongLongLongLongLongLongArg1,
+    function ($arg2) use ($var1) {
+        // body
+    },
+    $longLongLongLongLongLongLongLongLongLongArg3
+);
+
+`;
diff --git a/tests/closure/closure.php b/tests/closure/closure.php
new file mode 100644
index 0000000..87ed72d
--- /dev/null
+++ b/tests/closure/closure.php
@@ -0,0 +1,61 @@
+<?php
+
+$closureWithArgs = function ($arg1, $arg2) {
+    // body
+};
+
+$closureWithArgsAndVars = function ($arg1, $arg2) use ($var1, $var2) {
+    // body
+};
+
+$longArgs_noVars = function (
+    $longArgument,
+    $longerArgument,
+    $muchLongerArgument
+) {
+    // body
+};
+
+$noArgs_longVars = function () use (
+    $longLongLongLongVar1,
+    $longerLongerVar2,
+    $muchLongerVar3
+) {
+    // body
+};
+
+$longArgs_longVars = function (
+    $longArgument,
+    $longerArgument,
+    $muchLongerArgument
+) use (
+    $longLongLongLongLongLongLongVar1,
+    $longerLongerLongerLongerVar2,
+    $muchLongerVar3
+) {
+    // body
+};
+
+$longArgs_shortVars = function (
+    $longArgument,
+    $longerArgument,
+    $muchLongerArgument
+) use ($var1) {
+    // body
+};
+
+$shortArgs_longVars = function ($arg) use (
+    $longVar1,
+    $longerVar2,
+    $muchLongerVar3
+) {
+    // body
+};
+
+$foo->bar(
+    $longLongLongLongLongLongLongLongLongLongArg1,
+    function ($arg2) use ($var1) {
+        // body
+    },
+    $longLongLongLongLongLongLongLongLongLongArg3
+);
diff --git a/tests/closure/jsfmt.spec.js b/tests/closure/jsfmt.spec.js
new file mode 100644
index 0000000..e395434
--- /dev/null
+++ b/tests/closure/jsfmt.spec.js
@@ -0,0 +1,1 @@
+run_spec(__dirname, ["php"]);
diff --git a/tests/do/__snapshots__/jsfmt.spec.js.snap b/tests/do/__snapshots__/jsfmt.spec.js.snap
index a9cbc95..393c8b0 100644
--- a/tests/do/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/do/__snapshots__/jsfmt.spec.js.snap
@@ -19,6 +19,10 @@ do {
 
 do $var++;
 while ($var < 10);
+
+do {} while ($veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable);
+
+do {} while ($veryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable && $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable);
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 <?php
 $i = 1;
@@ -43,4 +47,17 @@ do {
     $var++;
 } while ($var < 10);
 
+do {
+
+} while (
+    $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable
+);
+
+do {
+
+} while (
+    $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable &&
+    $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable
+);
+
 `;
diff --git a/tests/do/do.php b/tests/do/do.php
index 4f87840..1773eeb 100644
--- a/tests/do/do.php
+++ b/tests/do/do.php
@@ -16,3 +16,7 @@ do {
 
 do $var++;
 while ($var < 10);
+
+do {} while ($veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable);
+
+do {} while ($veryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable && $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable);
diff --git a/tests/functions/__snapshots__/jsfmt.spec.js.snap b/tests/functions/__snapshots__/jsfmt.spec.js.snap
index 7199305..4655b5e 100644
--- a/tests/functions/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/functions/__snapshots__/jsfmt.spec.js.snap
@@ -90,91 +90,6 @@ function test(object $obj): object
 {
     return new SplQueue();
 }
-
-$db->Execute($sql, [
-  $foo,
-  $bar,
-  $foobar,
-  $somewhatLongParameter,
-  $somewhatLongParameterX,
-  $somewhatLongParameterXYZ
-]);
-
-$db->Execute([
-  $foo,
-  $bar,
-  $foobar,
-  $somewhatLongParameter,
-  $somewhatLongParameterX,
-  $somewhatLongParameterXYZ
-], $sql);
-
-$app->get('/hello/{name}', function ($name) use ($app) {
-    return 'Hello ' . $app->escape($name);
-});
-
-$this->something->method($argument, $this->more->stuff(
-    $this->even->more->things->complicatedMethod()
-));
-
-$this->something->method(
-    $this->more->stuff($this->even->more->things->complicatedMethod()),
-    $argument
-);
-
-$this->something->method(
-    $argument,
-    $otherArgument,
-    array("foo" => "bar", "baz" => "buzz"),
-    $this->even->more->things->complicatedMethod()
-);
-
-$this->files->put(
-    $path, $this->expiration($minutes).serialize($value), true
-);
-
-tap(((int) $raw['data']) + $value, function ($newValue) use ($key, $raw) {
-    $this->put($key, $newValue, $raw['time']);
-});
-
-$expire = substr(
-    $contents = $this->files->get($path, true), 0, 10
-);
-$this->app->singleton('session', function ($app) {
-    return new SessionManager($app);
-});
-
-$this->filter([
-    new MergeValue(['First', 'Second']),
-    'Taylor',
-    'Mohamed',
-    $this->mergeWhen(false, ['Adam', 'Matt']),
-    'Jeffrey',
-    new MergeValue(['Abigail', 'Lydia']),
-]);
-
-$this->assertEquals([
-    'First', 'Second', 'Taylor', 'Mohamed', 'Jeffrey', 'Abigail', 'Lydia',
-], $results);
-
-$this->assertEquals(['First'], $results);
-
-$some->other->thing(array(
-  'foo' => 'bar',
-  'buzz' => $this->is->nested(array(
-    'complex' => 'stuff',
-    'foo' => 'bar',
-    'buzz' => 'bazz'
-  ))
-));
-
-$some->other->thing(array(
-  'foo' => 'bar',
-  'buzz' => $this->is->nested(array(12, 34, 45, 67, 89))
-), array(
-  11323123,
-  1231, 13231233243, 324234234
-));
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 <?php
 function hello()
@@ -294,92 +209,4 @@ function test(object $obj): object
     return new SplQueue();
 }
 
-$db->Execute($sql, [
-    $foo,
-    $bar,
-    $foobar,
-    $somewhatLongParameter,
-    $somewhatLongParameterX,
-    $somewhatLongParameterXYZ
-]);
-
-$db->Execute([
-    $foo,
-    $bar,
-    $foobar,
-    $somewhatLongParameter,
-    $somewhatLongParameterX,
-    $somewhatLongParameterXYZ
-], $sql);
-
-$app->get('/hello/{name}', function ($name) use ($app) {
-    return 'Hello ' . $app->escape($name);
-});
-
-$this->something->method(
-    $argument,
-    $this->more->stuff($this->even->more->things->complicatedMethod())
-);
-
-$this->something->method(
-    $this->more->stuff($this->even->more->things->complicatedMethod()),
-    $argument
-);
-
-$this->something->method(
-    $argument,
-    $otherArgument,
-    array("foo" => "bar", "baz" => "buzz"),
-    $this->even->more->things->complicatedMethod()
-);
-
-$this->files->put($path, $this->expiration($minutes) . serialize($value), true);
-
-tap(((int) $raw['data']) + $value, function ($newValue) use ($key, $raw) {
-    $this->put($key, $newValue, $raw['time']);
-});
-
-$expire = substr($contents = $this->files->get($path, true), 0, 10);
-$this->app->singleton('session', function ($app) {
-    return new SessionManager($app);
-});
-
-$this->filter([
-    new MergeValue(['First', 'Second']),
-    'Taylor',
-    'Mohamed',
-    $this->mergeWhen(false, ['Adam', 'Matt']),
-    'Jeffrey',
-    new MergeValue(['Abigail', 'Lydia'])
-]);
-
-$this->assertEquals([
-    'First',
-    'Second',
-    'Taylor',
-    'Mohamed',
-    'Jeffrey',
-    'Abigail',
-    'Lydia'
-], $results);
-
-$this->assertEquals(['First'], $results);
-
-$some->other->thing(array(
-    'foo' => 'bar',
-    'buzz' => $this->is->nested(array(
-        'complex' => 'stuff',
-        'foo' => 'bar',
-        'buzz' => 'bazz'
-    ))
-));
-
-$some->other->thing(
-    array(
-        'foo' => 'bar',
-        'buzz' => $this->is->nested(array(12, 34, 45, 67, 89))
-    ),
-    array(11323123, 1231, 13231233243, 324234234)
-);
-
 `;
diff --git a/tests/functions/functions.php b/tests/functions/functions.php
index cad754e..a2c1e89 100644
--- a/tests/functions/functions.php
+++ b/tests/functions/functions.php
@@ -87,88 +87,3 @@ function test(object $obj): object
 {
     return new SplQueue();
 }
-
-$db->Execute($sql, [
-  $foo,
-  $bar,
-  $foobar,
-  $somewhatLongParameter,
-  $somewhatLongParameterX,
-  $somewhatLongParameterXYZ
-]);
-
-$db->Execute([
-  $foo,
-  $bar,
-  $foobar,
-  $somewhatLongParameter,
-  $somewhatLongParameterX,
-  $somewhatLongParameterXYZ
-], $sql);
-
-$app->get('/hello/{name}', function ($name) use ($app) {
-    return 'Hello ' . $app->escape($name);
-});
-
-$this->something->method($argument, $this->more->stuff(
-    $this->even->more->things->complicatedMethod()
-));
-
-$this->something->method(
-    $this->more->stuff($this->even->more->things->complicatedMethod()),
-    $argument
-);
-
-$this->something->method(
-    $argument,
-    $otherArgument,
-    array("foo" => "bar", "baz" => "buzz"),
-    $this->even->more->things->complicatedMethod()
-);
-
-$this->files->put(
-    $path, $this->expiration($minutes).serialize($value), true
-);
-
-tap(((int) $raw['data']) + $value, function ($newValue) use ($key, $raw) {
-    $this->put($key, $newValue, $raw['time']);
-});
-
-$expire = substr(
-    $contents = $this->files->get($path, true), 0, 10
-);
-$this->app->singleton('session', function ($app) {
-    return new SessionManager($app);
-});
-
-$this->filter([
-    new MergeValue(['First', 'Second']),
-    'Taylor',
-    'Mohamed',
-    $this->mergeWhen(false, ['Adam', 'Matt']),
-    'Jeffrey',
-    new MergeValue(['Abigail', 'Lydia']),
-]);
-
-$this->assertEquals([
-    'First', 'Second', 'Taylor', 'Mohamed', 'Jeffrey', 'Abigail', 'Lydia',
-], $results);
-
-$this->assertEquals(['First'], $results);
-
-$some->other->thing(array(
-  'foo' => 'bar',
-  'buzz' => $this->is->nested(array(
-    'complex' => 'stuff',
-    'foo' => 'bar',
-    'buzz' => 'bazz'
-  ))
-));
-
-$some->other->thing(array(
-  'foo' => 'bar',
-  'buzz' => $this->is->nested(array(12, 34, 45, 67, 89))
-), array(
-  11323123,
-  1231, 13231233243, 324234234
-));
diff --git a/tests/statement/__snapshots__/jsfmt.spec.js.snap b/tests/statement/__snapshots__/jsfmt.spec.js.snap
new file mode 100644
index 0000000..19c8f0a
--- /dev/null
+++ b/tests/statement/__snapshots__/jsfmt.spec.js.snap
@@ -0,0 +1,25 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`statement.php 1`] = `
+<?php
+$var = 1; $var = 2; function foo() { return 1; } class Test { public function method() {} } if (true) echo 'good';
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+<?php
+$var = 1;
+$var = 2;
+function foo()
+{
+    return 1;
+}
+class Test
+{
+    public function method()
+    {
+
+    }
+}
+if (true) {
+    echo 'good';
+}
+
+`;
diff --git a/tests/statement/jsfmt.spec.js b/tests/statement/jsfmt.spec.js
new file mode 100644
index 0000000..e395434
--- /dev/null
+++ b/tests/statement/jsfmt.spec.js
@@ -0,0 +1,1 @@
+run_spec(__dirname, ["php"]);
diff --git a/tests/statement/statement.php b/tests/statement/statement.php
new file mode 100644
index 0000000..4a1d29b
--- /dev/null
+++ b/tests/statement/statement.php
@@ -0,0 +1,2 @@
+<?php
+$var = 1; $var = 2; function foo() { return 1; } class Test { public function method() {} } if (true) echo 'good';
diff --git a/tests/while/__snapshots__/jsfmt.spec.js.snap b/tests/while/__snapshots__/jsfmt.spec.js.snap
index 408c267..893605b 100644
--- a/tests/while/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/while/__snapshots__/jsfmt.spec.js.snap
@@ -17,6 +17,10 @@ while ( $i <= 5 ) {
 
 while (true)
     $a = 1;
+
+while ($veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable) {}
+
+while ($veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable && $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable) {}
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 <?php
 $i = 1;
@@ -36,4 +40,17 @@ while (true) {
     $a = 1;
 }
 
+while (
+    $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable
+) {
+
+}
+
+while (
+    $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable &&
+    $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable
+) {
+
+}
+
 `;
diff --git a/tests/while/while.php b/tests/while/while.php
index ed6799c..b7cfab6 100644
--- a/tests/while/while.php
+++ b/tests/while/while.php
@@ -14,3 +14,7 @@ while ( $i <= 5 ) {
 
 while (true)
     $a = 1;
+
+while ($veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable) {}
+
+while ($veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable && $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable) {}