comparison vendor/nikic/php-parser/test/PhpParser/CodeParsingTest.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 5fb285c0d0e3
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
2 2
3 namespace PhpParser; 3 namespace PhpParser;
4 4
5 use PhpParser\Node\Expr; 5 use PhpParser\Node\Expr;
6 use PhpParser\Node\Stmt; 6 use PhpParser\Node\Stmt;
7
8 require_once __DIR__ . '/CodeTestAbstract.php';
9 7
10 class CodeParsingTest extends CodeTestAbstract 8 class CodeParsingTest extends CodeTestAbstract
11 { 9 {
12 /** 10 /**
13 * @dataProvider provideTestParse 11 * @dataProvider provideTestParse
50 new Parser\Php5($lexer), 48 new Parser\Php5($lexer),
51 new Parser\Php7($lexer), 49 new Parser\Php7($lexer),
52 ]; 50 ];
53 } 51 }
54 52
55 private function getParseOutput(Parser $parser, $code, array $modes) { 53 // Must be public for updateTests.php
54 public function getParseOutput(Parser $parser, $code, array $modes) {
56 $dumpPositions = isset($modes['positions']); 55 $dumpPositions = isset($modes['positions']);
57 56
58 $errors = new ErrorHandler\Collecting; 57 $errors = new ErrorHandler\Collecting;
59 $stmts = $parser->parse($code, $errors); 58 $stmts = $parser->parse($code, $errors);
60 59
76 } 75 }
77 76
78 private function formatErrorMessage(Error $e, $code) { 77 private function formatErrorMessage(Error $e, $code) {
79 if ($e->hasColumnInfo()) { 78 if ($e->hasColumnInfo()) {
80 return $e->getMessageWithColumnInfo($code); 79 return $e->getMessageWithColumnInfo($code);
81 } else {
82 return $e->getMessage();
83 } 80 }
81
82 return $e->getMessage();
84 } 83 }
85 84
86 private function checkAttributes($stmts) { 85 private function checkAttributes($stmts) {
87 if ($stmts === null) { 86 if ($stmts === null) {
88 return; 87 return;