diff options
Diffstat (limited to 'tools/TestGenerator.php')
-rw-r--r-- | tools/TestGenerator.php | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/tools/TestGenerator.php b/tools/TestGenerator.php index 5f59f01..d52e708 100644 --- a/tools/TestGenerator.php +++ b/tools/TestGenerator.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tools; @@ -46,14 +47,14 @@ class TestGenerator * * @var array */ - $lexerErrors = array(); + $lexerErrors = []; /** * Parser's errors. * * @var array */ - $parserErrors = array(); + $parserErrors = []; // Both the lexer and the parser construct exception for errors. // Usually, exceptions contain a full stack trace and other details that @@ -63,37 +64,37 @@ class TestGenerator // Extracting lexer's errors. if (! empty($lexer->errors)) { foreach ($lexer->errors as $err) { - $lexerErrors[] = array( + $lexerErrors[] = [ $err->getMessage(), $err->ch, $err->pos, - $err->getCode() - ); + $err->getCode(), + ]; } - $lexer->errors = array(); + $lexer->errors = []; } // Extracting parser's errors. if (! empty($parser->errors)) { foreach ($parser->errors as $err) { - $parserErrors[] = array( + $parserErrors[] = [ $err->getMessage(), $err->token, - $err->getCode() - ); + $err->getCode(), + ]; } - $parser->errors = array(); + $parser->errors = []; } - return array( + return [ 'query' => $query, 'lexer' => $lexer, 'parser' => $parser, - 'errors' => array( + 'errors' => [ 'lexer' => $lexerErrors, 'parser' => $parserErrors, - ) - ); + ], + ]; } /** @@ -109,7 +110,7 @@ class TestGenerator public static function build($type, $input, $output, $debug = null) { // Support query types: `lexer` / `parser`. - if (! in_array($type, array('lexer', 'parser'))) { + if (! in_array($type, ['lexer', 'parser'])) { throw new \Exception('Unknown test type (expected `lexer` or `parser`).'); } |