Mercurial > hg > isophonics-drupal-site
diff vendor/psy/psysh/test/CodeCleaner/ListPassTest.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | c2387f117808 |
children |
line wrap: on
line diff
--- a/vendor/psy/psysh/test/CodeCleaner/ListPassTest.php Tue Jul 10 15:07:59 2018 +0100 +++ b/vendor/psy/psysh/test/CodeCleaner/ListPassTest.php Thu Feb 28 13:21:36 2019 +0000 @@ -26,7 +26,7 @@ */ 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,20 +50,23 @@ ['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], ]); } @@ -84,8 +87,8 @@ ['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)'], @@ -96,6 +99,14 @@ ['[,$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]'], ]); }