Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / psy / psysh / test / CodeCleaner / ListPassTest.php
index 06954cb118b079767b114ae910110a5fc066c3a4..b7a360d69070cc782e7c5855636180a45515f746 100644 (file)
@@ -26,7 +26,7 @@ class ListPassTest extends CodeCleanerTestCase
      */
     public function testProcessInvalidStatement($code, $expectedMessage)
     {
-        if (method_exists($this, 'setExpectedException')) {
+        if (\method_exists($this, 'setExpectedException')) {
             $this->setExpectedException('Psy\Exception\ParseErrorException', $expectedMessage);
         } else {
             $this->expectExceptionMessage($expectedMessage);
@@ -50,19 +50,23 @@ class ListPassTest extends CodeCleanerTestCase
             ['list("a") = array(1)', $errorPhpParserSyntax],
         ];
 
-        if (version_compare(PHP_VERSION, '7.1', '<')) {
-            return array_merge($invalidExpr, [
+        if (\version_compare(PHP_VERSION, '7.1', '<')) {
+            return \array_merge($invalidExpr, [
                 ['list("a" => _) = array("a" => 1)', $errorPhpParserSyntax],
                 ['[] = []', $errorShortListAssign],
                 ['[$a] = [1]', $errorShortListAssign],
                 ['list("a" => $a) = array("a" => 1)', $errorAssocListAssign],
+                ['[$a[0], $a[1]] = [1, 2]', $errorShortListAssign],
+                ['[$a->b, $a->c] = [1, 2]', $errorShortListAssign],
             ]);
         }
 
-        return array_merge($invalidExpr, [
+        return \array_merge($invalidExpr, [
             ['list("a" => _) = array("a" => 1)', $errorPhpParserSyntax],
             ['["a"] = [1]', $errorNonVariableAssign],
             ['[] = []', $errorEmptyList],
+            ['[,] = [1,2]', $errorEmptyList],
+            ['[,,] = [1,2,3]', $errorEmptyList],
         ]);
     }
 
@@ -83,14 +87,26 @@ class ListPassTest extends CodeCleanerTestCase
             ['list($x, $y) = array(1, 2)'],
         ];
 
-        if (version_compare(PHP_VERSION, '7.1', '>=')) {
-            return array_merge($validExpr, [
+        if (\version_compare(PHP_VERSION, '7.1', '>=')) {
+            return \array_merge($validExpr, [
                 ['[$a] = array(1)'],
                 ['list($b) = [2]'],
                 ['[$x, $y] = array(1, 2)'],
                 ['[$a] = [1]'],
                 ['[$x, $y] = [1, 2]'],
                 ['["_" => $v] = ["_" => 1]'],
+                ['[$a,] = [1,2,3]'],
+                ['[,$b] = [1,2,3]'],
+                ['[$a,,$c] = [1,2,3]'],
+                ['[$a,,,] = [1,2,3]'],
+                ['[$a[0], $a[1]] = [1, 2]'],
+                ['[$a[0][0][0], $a[0][0][1]] = [1, 2]'],
+                ['[$a->b, $a->c] = [1, 2]'],
+                ['[$a->b[0], $a->c[1]] = [1, 2]'],
+                ['[$a[0]->b[0], $a[0]->c[1]] = [1, 2]'],
+                ['[$a[$b->c + $b->d]] = [1]'],
+                ['[$a->c()->d, $a->c()->e] = [1, 2]'],
+                ['[x()->a, x()->b] = [1, 2]'],
             ]);
         }