diff options
author | Maurício Meneghini Fauth <mauriciofauth@gmail.com> | 2019-01-16 18:07:19 -0200 |
---|---|---|
committer | Maurício Meneghini Fauth <mauriciofauth@gmail.com> | 2019-01-16 18:07:19 -0200 |
commit | 17da8a34b81442524a8e01fead7b5968fa1cc39d (patch) | |
tree | af443eb31a13b3c4461a3322e10d376571f6d3b6 | |
parent | 86c5baebda24c1721fb6881df8671a3c7df60e8b (diff) | |
download | sql-parser-17da8a34b81442524a8e01fead7b5968fa1cc39d.zip sql-parser-17da8a34b81442524a8e01fead7b5968fa1cc39d.tar.gz sql-parser-17da8a34b81442524a8e01fead7b5968fa1cc39d.tar.bz2 |
Enable strict mode on PHP files
Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
160 files changed, 177 insertions, 103 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 98af7b8..747fd20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## [Unreleased] * Drop support for PHP 5.3, PHP 5.4, PHP 5.5, PHP 5.6, PHP 7.0 and HHVM +* Enable strict mode on PHP files ## [4.3.1] - 2019-01-05 diff --git a/bin/highlight-query b/bin/highlight-query index 577e4fb..a25a3e2 100755 --- a/bin/highlight-query +++ b/bin/highlight-query @@ -1,5 +1,6 @@ #!/usr/bin/env php <?php +declare(strict_types=1); $files = array( __DIR__ . "/../vendor/autoload.php", diff --git a/bin/lint-query b/bin/lint-query index 67e7114..8d7cd29 100755 --- a/bin/lint-query +++ b/bin/lint-query @@ -1,5 +1,6 @@ #!/usr/bin/env php <?php +declare(strict_types=1); $files = array( __DIR__ . "/../vendor/autoload.php", @@ -27,4 +28,3 @@ if (!$found) { $cli = new PhpMyAdmin\SqlParser\Utils\CLI(); exit($cli->runLint()); - diff --git a/bin/tokenize-query b/bin/tokenize-query index f32a4e0..97012c7 100755 --- a/bin/tokenize-query +++ b/bin/tokenize-query @@ -1,5 +1,6 @@ #!/usr/bin/env php <?php +declare(strict_types=1); $files = array( __DIR__ . "/../vendor/autoload.php", diff --git a/src/Component.php b/src/Component.php index d121e9b..520735b 100644 --- a/src/Component.php +++ b/src/Component.php @@ -1,5 +1,4 @@ <?php - /** * Defines a component that is later extended to parse specialized components or * keywords. @@ -8,6 +7,7 @@ * *Component parsers can be reused in multiple situations and *Keyword parsers * count on the *Component classes to do their job. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser; diff --git a/src/Components/AlterOperation.php b/src/Components/AlterOperation.php index 25a62a5..35960ee 100644 --- a/src/Components/AlterOperation.php +++ b/src/Components/AlterOperation.php @@ -1,8 +1,8 @@ <?php - /** * Parses an alter operation. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Components; diff --git a/src/Components/Array2d.php b/src/Components/Array2d.php index ced529a..7c99952 100644 --- a/src/Components/Array2d.php +++ b/src/Components/Array2d.php @@ -1,8 +1,8 @@ <?php - /** * `VALUES` keyword parser. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Components; diff --git a/src/Components/ArrayObj.php b/src/Components/ArrayObj.php index f968d87..7748be9 100644 --- a/src/Components/ArrayObj.php +++ b/src/Components/ArrayObj.php @@ -1,8 +1,8 @@ <?php - /** * Parses an array. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Components; diff --git a/src/Components/CaseExpression.php b/src/Components/CaseExpression.php index d66ddc3..a79b52e 100644 --- a/src/Components/CaseExpression.php +++ b/src/Components/CaseExpression.php @@ -1,8 +1,8 @@ <?php - /** * Parses a reference to a CASE expression. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Components; diff --git a/src/Components/Condition.php b/src/Components/Condition.php index 83b80b2..c37ce19 100644 --- a/src/Components/Condition.php +++ b/src/Components/Condition.php @@ -1,8 +1,8 @@ <?php - /** * `WHERE` keyword parser. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Components; @@ -87,7 +87,7 @@ class Condition extends Component */ public function __construct($expr = null) { - $this->expr = trim($expr); + $this->expr = trim((string) $expr); } /** diff --git a/src/Components/CreateDefinition.php b/src/Components/CreateDefinition.php index ccf8497..3d3a3f4 100644 --- a/src/Components/CreateDefinition.php +++ b/src/Components/CreateDefinition.php @@ -1,10 +1,10 @@ <?php - /** * Parses the create definition of a column or a key. * * Used for parsing `CREATE TABLE` statement. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Components; diff --git a/src/Components/DataType.php b/src/Components/DataType.php index 47fffba..5be45c6 100644 --- a/src/Components/DataType.php +++ b/src/Components/DataType.php @@ -1,8 +1,8 @@ <?php - /** * Parses a data type. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Components; @@ -127,7 +127,7 @@ class DataType extends Component } if ($state === 0) { - $ret->name = strtoupper($token->value); + $ret->name = strtoupper((string) $token->value); if (($token->type !== Token::TYPE_KEYWORD) || (! ($token->flags & Token::FLAG_KEYWORD_DATA_TYPE))) { $parser->error('Unrecognized data type.', $token); } diff --git a/src/Components/Expression.php b/src/Components/Expression.php index 7383275..7a71c76 100644 --- a/src/Components/Expression.php +++ b/src/Components/Expression.php @@ -1,9 +1,9 @@ <?php - /** * Parses a reference to an expression (column, table or database name, function * call, mathematical expression, etc.). */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Components; @@ -269,7 +269,7 @@ class Expression extends Component continue; } $isExpr = true; - } elseif ($brackets === 0 && strlen($ret->expr) > 0 && ! $alias) { + } elseif ($brackets === 0 && strlen((string) $ret->expr) > 0 && ! $alias) { /* End of expression */ break; } @@ -413,7 +413,7 @@ class Expression extends Component } // White-spaces might be added at the end. - $ret->expr = trim($ret->expr); + $ret->expr = trim((string) $ret->expr); if ($ret->expr === '') { return null; diff --git a/src/Components/ExpressionArray.php b/src/Components/ExpressionArray.php index 5d94681..2f44d7a 100644 --- a/src/Components/ExpressionArray.php +++ b/src/Components/ExpressionArray.php @@ -1,8 +1,8 @@ <?php - /** * Parses a list of expressions delimited by a comma. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Components; diff --git a/src/Components/FunctionCall.php b/src/Components/FunctionCall.php index 067987f..382ee8f 100644 --- a/src/Components/FunctionCall.php +++ b/src/Components/FunctionCall.php @@ -1,8 +1,8 @@ <?php - /** * Parses a function call. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Components; diff --git a/src/Components/GroupKeyword.php b/src/Components/GroupKeyword.php index 86de663..9aa583d 100644 --- a/src/Components/GroupKeyword.php +++ b/src/Components/GroupKeyword.php @@ -1,8 +1,8 @@ <?php - /** * `GROUP BY` keyword parser. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Components; @@ -126,6 +126,6 @@ class GroupKeyword extends Component return implode(', ', $component); } - return trim($component->expr); + return trim((string) $component->expr); } } diff --git a/src/Components/IndexHint.php b/src/Components/IndexHint.php index 12edda7..a0cb0f1 100644 --- a/src/Components/IndexHint.php +++ b/src/Components/IndexHint.php @@ -1,8 +1,8 @@ <?php - /** * Parses an Index hint. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Components; diff --git a/src/Components/IntoKeyword.php b/src/Components/IntoKeyword.php index 524d94c..1941c22 100644 --- a/src/Components/IntoKeyword.php +++ b/src/Components/IntoKeyword.php @@ -1,8 +1,8 @@ <?php - /** * `INTO` keyword parser. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Components; diff --git a/src/Components/JoinKeyword.php b/src/Components/JoinKeyword.php index 6a13177..330c1f2 100644 --- a/src/Components/JoinKeyword.php +++ b/src/Components/JoinKeyword.php @@ -1,8 +1,8 @@ <?php - /** * `JOIN` keyword parser. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Components; diff --git a/src/Components/Key.php b/src/Components/Key.php index 3093f01..37e51a4 100644 --- a/src/Components/Key.php +++ b/src/Components/Key.php @@ -1,8 +1,8 @@ <?php - /** * Parses the definition of a key. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Components; diff --git a/src/Components/Limit.php b/src/Components/Limit.php index d02ce49..edb25fb 100644 --- a/src/Components/Limit.php +++ b/src/Components/Limit.php @@ -1,8 +1,8 @@ <?php - /** * `LIMIT` keyword parser. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Components; diff --git a/src/Components/LockExpression.php b/src/Components/LockExpression.php index 7cbfa72..8bf03ce 100644 --- a/src/Components/LockExpression.php +++ b/src/Components/LockExpression.php @@ -1,8 +1,8 @@ <?php - /** * Parses a reference to a LOCK expression. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Components; diff --git a/src/Components/OptionsArray.php b/src/Components/OptionsArray.php index 2b17cdd..f872b14 100644 --- a/src/Components/OptionsArray.php +++ b/src/Components/OptionsArray.php @@ -1,8 +1,8 @@ <?php - /** * Parses a list of options. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Components; diff --git a/src/Components/OrderKeyword.php b/src/Components/OrderKeyword.php index f6d60eb..820fdd1 100644 --- a/src/Components/OrderKeyword.php +++ b/src/Components/OrderKeyword.php @@ -1,8 +1,8 @@ <?php - /** * `ORDER BY` keyword parser. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Components; diff --git a/src/Components/ParameterDefinition.php b/src/Components/ParameterDefinition.php index f45d6ac..d4165ee 100644 --- a/src/Components/ParameterDefinition.php +++ b/src/Components/ParameterDefinition.php @@ -1,8 +1,8 @@ <?php - /** * The definition of a parameter of a function or procedure. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Components; diff --git a/src/Components/PartitionDefinition.php b/src/Components/PartitionDefinition.php index 03f4aa6..58223ea 100644 --- a/src/Components/PartitionDefinition.php +++ b/src/Components/PartitionDefinition.php @@ -1,10 +1,10 @@ <?php - /** * Parses the create definition of a partition. * * Used for parsing `CREATE TABLE` statement. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Components; diff --git a/src/Components/Reference.php b/src/Components/Reference.php index 3f8e453..4077f77 100644 --- a/src/Components/Reference.php +++ b/src/Components/Reference.php @@ -1,8 +1,8 @@ <?php - /** * `REFERENCES` keyword parser. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Components; diff --git a/src/Components/RenameOperation.php b/src/Components/RenameOperation.php index 4bdb67e..d11a187 100644 --- a/src/Components/RenameOperation.php +++ b/src/Components/RenameOperation.php @@ -1,8 +1,8 @@ <?php - /** * `RENAME TABLE` keyword parser. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Components; diff --git a/src/Components/SetOperation.php b/src/Components/SetOperation.php index 68f2297..4c8ced3 100644 --- a/src/Components/SetOperation.php +++ b/src/Components/SetOperation.php @@ -1,8 +1,8 @@ <?php - /** * `SET` keyword parser. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Components; diff --git a/src/Components/UnionKeyword.php b/src/Components/UnionKeyword.php index 220f86e..dc06831 100644 --- a/src/Components/UnionKeyword.php +++ b/src/Components/UnionKeyword.php @@ -1,8 +1,8 @@ <?php - /** * `UNION` keyword builder. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Components; diff --git a/src/Context.php b/src/Context.php index 646f373..3f51dc7 100644 --- a/src/Context.php +++ b/src/Context.php @@ -1,11 +1,11 @@ <?php - /** * Defines a context class that is later extended to define other contexts. * * A context is a collection of keywords, operators and functions used for * parsing. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser; diff --git a/src/Contexts/ContextMariaDb100000.php b/src/Contexts/ContextMariaDb100000.php index a260083..cb0ac6e 100644 --- a/src/Contexts/ContextMariaDb100000.php +++ b/src/Contexts/ContextMariaDb100000.php @@ -1,5 +1,4 @@ <?php - /** * Context for MariaDB 10.0. * @@ -7,6 +6,7 @@ * * @see https://mariadb.com/kb/en/the-mariadb-library/reserved-words/ */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Contexts; diff --git a/src/Contexts/ContextMariaDb100100.php b/src/Contexts/ContextMariaDb100100.php index 0208084..7a419ab 100644 --- a/src/Contexts/ContextMariaDb100100.php +++ b/src/Contexts/ContextMariaDb100100.php @@ -1,5 +1,4 @@ <?php - /** * Context for MariaDB 10.1. * @@ -7,6 +6,7 @@ * * @see https://mariadb.com/kb/en/the-mariadb-library/reserved-words/ */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Contexts; diff --git a/src/Contexts/ContextMariaDb100200.php b/src/Contexts/ContextMariaDb100200.php index f2f7334..e0923ad 100644 --- a/src/Contexts/ContextMariaDb100200.php +++ b/src/Contexts/ContextMariaDb100200.php @@ -1,5 +1,4 @@ <?php - /** * Context for MariaDB 10.2. * @@ -7,6 +6,7 @@ * * @see https://mariadb.com/kb/en/the-mariadb-library/reserved-words/ */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Contexts; diff --git a/src/Contexts/ContextMariaDb100300.php b/src/Contexts/ContextMariaDb100300.php index c2a3847..b162600 100644 --- a/src/Contexts/ContextMariaDb100300.php +++ b/src/Contexts/ContextMariaDb100300.php @@ -1,5 +1,4 @@ <?php - /** * Context for MariaDB 10.3. * @@ -7,6 +6,7 @@ * * @see https://mariadb.com/kb/en/the-mariadb-library/reserved-words/ */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Contexts; diff --git a/src/Contexts/ContextMySql50000.php b/src/Contexts/ContextMySql50000.php index 649a731..5a8322b 100644 --- a/src/Contexts/ContextMySql50000.php +++ b/src/Contexts/ContextMySql50000.php @@ -1,5 +1,4 @@ <?php - /** * Context for MySQL 5.0. * @@ -7,6 +6,7 @@ * * @see https://dev.mysql.com/doc/refman/5.0/en/keywords.html */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Contexts; diff --git a/src/Contexts/ContextMySql50100.php b/src/Contexts/ContextMySql50100.php index 2531f2c..e4d353e 100644 --- a/src/Contexts/ContextMySql50100.php +++ b/src/Contexts/ContextMySql50100.php @@ -1,5 +1,4 @@ <?php - /** * Context for MySQL 5.1. * @@ -7,6 +6,7 @@ * * @see https://dev.mysql.com/doc/refman/5.1/en/keywords.html */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Contexts; diff --git a/src/Contexts/ContextMySql50500.php b/src/Contexts/ContextMySql50500.php index 9587116..2ef9b81 100644 --- a/src/Contexts/ContextMySql50500.php +++ b/src/Contexts/ContextMySql50500.php @@ -1,5 +1,4 @@ <?php - /** * Context for MySQL 5.5. * @@ -7,6 +6,7 @@ * * @see https://dev.mysql.com/doc/refman/5.5/en/keywords.html */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Contexts; diff --git a/src/Contexts/ContextMySql50600.php b/src/Contexts/ContextMySql50600.php index 0720957..5fa8786 100644 --- a/src/Contexts/ContextMySql50600.php +++ b/src/Contexts/ContextMySql50600.php @@ -1,5 +1,4 @@ <?php - /** * Context for MySQL 5.6. * @@ -7,6 +6,7 @@ * * @see https://dev.mysql.com/doc/refman/5.6/en/keywords.html */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Contexts; diff --git a/src/Contexts/ContextMySql50700.php b/src/Contexts/ContextMySql50700.php index b87affa..6f24dc1 100644 --- a/src/Contexts/ContextMySql50700.php +++ b/src/Contexts/ContextMySql50700.php @@ -1,5 +1,4 @@ <?php - /** * Context for MySQL 5.7. * @@ -7,6 +6,7 @@ * * @see https://dev.mysql.com/doc/refman/5.7/en/keywords.html */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Contexts; diff --git a/src/Contexts/ContextMySql80000.php b/src/Contexts/ContextMySql80000.php index 35ac008..df581f5 100644 --- a/src/Contexts/ContextMySql80000.php +++ b/src/Contexts/ContextMySql80000.php @@ -1,5 +1,4 @@ <?php - /** * Context for MySQL 8.0. * @@ -7,6 +6,7 @@ * * @see https://dev.mysql.com/doc/refman/8.0/en/keywords.html */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Contexts; diff --git a/src/Core.php b/src/Core.php index 5672b99..1965a2f 100644 --- a/src/Core.php +++ b/src/Core.php @@ -1,8 +1,8 @@ <?php - /** * Defines the core helper infrastructure of the library. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser; diff --git a/src/Exceptions/LexerException.php b/src/Exceptions/LexerException.php index 61e88c9..7dd85a4 100644 --- a/src/Exceptions/LexerException.php +++ b/src/Exceptions/LexerException.php @@ -1,8 +1,8 @@ <?php - /** * Exception thrown by the lexer. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Exceptions; diff --git a/src/Exceptions/LoaderException.php b/src/Exceptions/LoaderException.php index bfbd4c3..d809876 100644 --- a/src/Exceptions/LoaderException.php +++ b/src/Exceptions/LoaderException.php @@ -1,8 +1,8 @@ <?php - /** * Exception thrown by the lexer. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Exceptions; diff --git a/src/Exceptions/ParserException.php b/src/Exceptions/ParserException.php index eb13653..575eeb1 100644 --- a/src/Exceptions/ParserException.php +++ b/src/Exceptions/ParserException.php @@ -1,8 +1,8 @@ <?php - /** * Exception thrown by the parser. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Exceptions; diff --git a/src/Lexer.php b/src/Lexer.php index 13796cd..53545af 100644 --- a/src/Lexer.php +++ b/src/Lexer.php @@ -1,5 +1,4 @@ <?php - /** * Defines the lexer of the library. * @@ -7,6 +6,7 @@ * * Depends on context to extract lexemes. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser; diff --git a/src/Parser.php b/src/Parser.php index c0e755a..91524fd 100644 --- a/src/Parser.php +++ b/src/Parser.php @@ -1,10 +1,10 @@ <?php - /** * Defines the parser of the library. * * This is one of the most important components, along with the lexer. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser; diff --git a/src/Statement.php b/src/Statement.php index 281701c..41cf3e6 100644 --- a/src/Statement.php +++ b/src/Statement.php @@ -1,11 +1,11 @@ <?php - /** * The result of the parser is an array of statements are extensions of the * class defined here. * * A statement represents the result of parsing the lexemes. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser; diff --git a/src/Statements/AlterStatement.php b/src/Statements/AlterStatement.php index 3909c42..0620936 100644 --- a/src/Statements/AlterStatement.php +++ b/src/Statements/AlterStatement.php @@ -1,8 +1,8 @@ <?php - /** * `ALTER` statement. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; diff --git a/src/Statements/AnalyzeStatement.php b/src/Statements/AnalyzeStatement.php index 4166bdb..ebc7f70 100644 --- a/src/Statements/AnalyzeStatement.php +++ b/src/Statements/AnalyzeStatement.php @@ -1,8 +1,8 @@ <?php - /** * `ANALYZE` statement. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; diff --git a/src/Statements/BackupStatement.php b/src/Statements/BackupStatement.php index 0c8c314..574dc9a 100644 --- a/src/Statements/BackupStatement.php +++ b/src/Statements/BackupStatement.php @@ -1,8 +1,8 @@ <?php - /** * `BACKUP` statement. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; diff --git a/src/Statements/CallStatement.php b/src/Statements/CallStatement.php index 51f1011..8b02787 100644 --- a/src/Statements/CallStatement.php +++ b/src/Statements/CallStatement.php @@ -1,8 +1,8 @@ <?php - /** * `CALL` statement. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; diff --git a/src/Statements/CheckStatement.php b/src/Statements/CheckStatement.php index 690818c..789679f 100644 --- a/src/Statements/CheckStatement.php +++ b/src/Statements/CheckStatement.php @@ -1,8 +1,8 @@ <?php - /** * `CHECK` statement. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; diff --git a/src/Statements/ChecksumStatement.php b/src/Statements/ChecksumStatement.php index 3ddca9a..3214748 100644 --- a/src/Statements/ChecksumStatement.php +++ b/src/Statements/ChecksumStatement.php @@ -1,8 +1,8 @@ <?php - /** * `CHECKSUM` statement. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; diff --git a/src/Statements/CreateStatement.php b/src/Statements/CreateStatement.php index 61ffac2..ffa08bc 100644 --- a/src/Statements/CreateStatement.php +++ b/src/Statements/CreateStatement.php @@ -1,8 +1,8 @@ <?php - /** * `CREATE` statement. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; diff --git a/src/Statements/DeleteStatement.php b/src/Statements/DeleteStatement.php index 879fe2e..b55d5f4 100644 --- a/src/Statements/DeleteStatement.php +++ b/src/Statements/DeleteStatement.php @@ -1,8 +1,8 @@ <?php - /** * `DELETE` statement. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; @@ -184,7 +184,7 @@ class DeleteStatement extends Statement if (! is_null($this->order) && count($this->order) > 0) { $ret .= ' ORDER BY ' . ExpressionArray::build($this->order); } - if (! is_null($this->limit) && strlen($this->limit) > 0) { + if (! is_null($this->limit) && strlen((string) $this->limit) > 0) { $ret .= ' LIMIT ' . Limit::build($this->limit); } diff --git a/src/Statements/DropStatement.php b/src/Statements/DropStatement.php index 1ec1c72..453bed1 100644 --- a/src/Statements/DropStatement.php +++ b/src/Statements/DropStatement.php @@ -1,8 +1,8 @@ <?php - /** * `DROP` statement. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; diff --git a/src/Statements/ExplainStatement.php b/src/Statements/ExplainStatement.php index 96a5828..65ea597 100644 --- a/src/Statements/ExplainStatement.php +++ b/src/Statements/ExplainStatement.php @@ -1,8 +1,8 @@ <?php - /** * `EXPLAIN` statement. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; diff --git a/src/Statements/InsertStatement.php b/src/Statements/InsertStatement.php index f2b6348..4230033 100644 --- a/src/Statements/InsertStatement.php +++ b/src/Statements/InsertStatement.php @@ -1,8 +1,8 @@ <?php - /** * `INSERT` statement. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; @@ -117,7 +117,7 @@ class InsertStatement extends Statement $ret .= ' VALUES ' . Array2d::build($this->values); } elseif (! is_null($this->set) && count($this->set) > 0) { $ret .= ' SET ' . SetOperation::build($this->set); - } elseif (! is_null($this->select) && strlen($this->select) > 0) { + } elseif (! is_null($this->select) && strlen((string) $this->select) > 0) { $ret .= ' ' . $this->select->build(); } diff --git a/src/Statements/LoadStatement.php b/src/Statements/LoadStatement.php index c9179aa..c5186cf 100644 --- a/src/Statements/LoadStatement.php +++ b/src/Statements/LoadStatement.php @@ -1,8 +1,8 @@ <?php - /** * `LOAD` statement. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; @@ -194,7 +194,7 @@ class LoadStatement extends Statement $ret .= ' INTO TABLE ' . $this->table; - if ($this->partition !== null && strlen($this->partition) > 0) { + if ($this->partition !== null && strlen((string) $this->partition) > 0) { $ret .= ' PARTITION ' . ArrayObj::build($this->partition); } @@ -206,7 +206,7 @@ class LoadStatement extends Statement $ret .= ' ' . $this->fields_keyword . ' ' . $this->fields_options; } - if ($this->lines_options !== null && strlen($this->lines_options) > 0) { + if ($this->lines_options !== null && strlen((string) $this->lines_options) > 0) { $ret .= ' LINES ' . $this->lines_options; } diff --git a/src/Statements/LockStatement.php b/src/Statements/LockStatement.php index 354d446..0166dca 100644 --- a/src/Statements/LockStatement.php +++ b/src/Statements/LockStatement.php @@ -1,8 +1,8 @@ <?php - /** * `LOCK` statement. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; diff --git a/src/Statements/MaintenanceStatement.php b/src/Statements/MaintenanceStatement.php index ac3b8c9..c59bb77 100644 --- a/src/Statements/MaintenanceStatement.php +++ b/src/Statements/MaintenanceStatement.php @@ -1,8 +1,8 @@ <?php - /** * Maintenance statement. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; diff --git a/src/Statements/NotImplementedStatement.php b/src/Statements/NotImplementedStatement.php index f5da4a1..254ca15 100644 --- a/src/Statements/NotImplementedStatement.php +++ b/src/Statements/NotImplementedStatement.php @@ -1,8 +1,8 @@ <?php - /** * Not implemented (yet) statements. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; diff --git a/src/Statements/OptimizeStatement.php b/src/Statements/OptimizeStatement.php index 19c95e5..cd9be0c 100644 --- a/src/Statements/OptimizeStatement.php +++ b/src/Statements/OptimizeStatement.php @@ -1,8 +1,8 @@ <?php - /** * `OPTIMIZE` statement. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; diff --git a/src/Statements/PurgeStatement.php b/src/Statements/PurgeStatement.php index 79a684f..4dc385e 100644 --- a/src/Statements/PurgeStatement.php +++ b/src/Statements/PurgeStatement.php @@ -1,8 +1,8 @@ <?php - /** * `PURGE` statement. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; diff --git a/src/Statements/RenameStatement.php b/src/Statements/RenameStatement.php index e1bcf0d..17662d3 100644 --- a/src/Statements/RenameStatement.php +++ b/src/Statements/RenameStatement.php @@ -1,8 +1,8 @@ <?php - /** * `RENAME` statement. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; diff --git a/src/Statements/RepairStatement.php b/src/Statements/RepairStatement.php index a9e058a..e17cdee 100644 --- a/src/Statements/RepairStatement.php +++ b/src/Statements/RepairStatement.php @@ -1,8 +1,8 @@ <?php - /** * `REPAIR` statement. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; diff --git a/src/Statements/ReplaceStatement.php b/src/Statements/ReplaceStatement.php index 72e6841..c5903c0 100644 --- a/src/Statements/ReplaceStatement.php +++ b/src/Statements/ReplaceStatement.php @@ -1,8 +1,8 @@ <?php - /** * `REPLACE` statement. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; @@ -93,7 +93,7 @@ class ReplaceStatement extends Statement $ret .= ' VALUES ' . Array2d::build($this->values); } elseif (! is_null($this->set) && count($this->set) > 0) { $ret .= ' SET ' . SetOperation::build($this->set); - } elseif (! is_null($this->select) && strlen($this->select) > 0) { + } elseif (! is_null($this->select) && strlen((string) $this->select) > 0) { $ret .= ' ' . $this->select->build(); } diff --git a/src/Statements/RestoreStatement.php b/src/Statements/RestoreStatement.php index 6a2b44f..6d2a72e 100644 --- a/src/Statements/RestoreStatement.php +++ b/src/Statements/RestoreStatement.php @@ -1,8 +1,8 @@ <?php - /** * `RESTORE` statement. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; diff --git a/src/Statements/SelectStatement.php b/src/Statements/SelectStatement.php index 1bff148..dab8db4 100644 --- a/src/Statements/SelectStatement.php +++ b/src/Statements/SelectStatement.php @@ -1,8 +1,8 @@ <?php - /** * `SELECT` statement. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; diff --git a/src/Statements/SetStatement.php b/src/Statements/SetStatement.php index 129cc14..cc1e487 100644 --- a/src/Statements/SetStatement.php +++ b/src/Statements/SetStatement.php @@ -1,8 +1,8 @@ <?php - /** * `SET` statement. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; diff --git a/src/Statements/ShowStatement.php b/src/Statements/ShowStatement.php index 4205310..d332968 100644 --- a/src/Statements/ShowStatement.php +++ b/src/Statements/ShowStatement.php @@ -1,8 +1,8 @@ <?php - /** * `SHOW` statement. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; diff --git a/src/Statements/TransactionStatement.php b/src/Statements/TransactionStatement.php index fae935a..7c07b5f 100644 --- a/src/Statements/TransactionStatement.php +++ b/src/Statements/TransactionStatement.php @@ -1,8 +1,8 @@ <?php - /** * Transaction statement. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; diff --git a/src/Statements/TruncateStatement.php b/src/Statements/TruncateStatement.php index c95dfd0..52f6347 100644 --- a/src/Statements/TruncateStatement.php +++ b/src/Statements/TruncateStatement.php @@ -1,8 +1,8 @@ <?php - /** * `TRUNCATE` statement. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; diff --git a/src/Statements/UpdateStatement.php b/src/Statements/UpdateStatement.php index 2dee189..8e6708f 100644 --- a/src/Statements/UpdateStatement.php +++ b/src/Statements/UpdateStatement.php @@ -1,8 +1,8 @@ <?php - /** * `UPDATE` statement. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; diff --git a/src/Token.php b/src/Token.php index 1965f8b..fe43e8b 100644 --- a/src/Token.php +++ b/src/Token.php @@ -1,10 +1,10 @@ <?php - /** * Defines a token along with a set of types and flags and utility functions. * * An array of tokens will result after parsing the query. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser; diff --git a/src/TokensList.php b/src/TokensList.php index 8d711f8..507d68b 100644 --- a/src/TokensList.php +++ b/src/TokensList.php @@ -1,8 +1,8 @@ <?php - /** * Defines an array of tokens and utility functions to iterate through it. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser; diff --git a/src/Translator.php b/src/Translator.php index 622bec9..a169632 100644 --- a/src/Translator.php +++ b/src/Translator.php @@ -1,8 +1,8 @@ <?php - /** * Defines the localization helper infrastructure of the library. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser; diff --git a/src/UtfString.php b/src/UtfString.php index 58905f3..9e6e55b 100644 --- a/src/UtfString.php +++ b/src/UtfString.php @@ -1,5 +1,4 @@ <?php - /** * Implementation for UTF-8 strings. * @@ -10,6 +9,7 @@ * Because the lexer relies on the subscript operator this class had to be * implemented. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser; diff --git a/src/Utils/BufferedQuery.php b/src/Utils/BufferedQuery.php index 5edf903..c2dd074 100644 --- a/src/Utils/BufferedQuery.php +++ b/src/Utils/BufferedQuery.php @@ -1,8 +1,8 @@ <?php - /** * Buffered query utilities. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Utils; diff --git a/src/Utils/CLI.php b/src/Utils/CLI.php index d2c27f2..31d09ce 100644 --- a/src/Utils/CLI.php +++ b/src/Utils/CLI.php @@ -1,8 +1,8 @@ <?php - /** * CLI interface. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Utils; diff --git a/src/Utils/Error.php b/src/Utils/Error.php index af9706f..d0f82ed 100644 --- a/src/Utils/Error.php +++ b/src/Utils/Error.php @@ -1,8 +1,8 @@ <?php - /** * Error related utilities. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Utils; @@ -86,7 +86,7 @@ class Error ++$i, $err[0], $err[1], - htmlspecialchars($err[2]), + htmlspecialchars((string) $err[2]), $err[3] ); } diff --git a/src/Utils/Formatter.php b/src/Utils/Formatter.php index 2d2ca40..94d908c 100644 --- a/src/Utils/Formatter.php +++ b/src/Utils/Formatter.php @@ -1,8 +1,8 @@ <?php - /** * Utilities that are used for formatting queries. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Utils; @@ -500,7 +500,7 @@ class Formatter // No space after . ( || ($curr->type === Token::TYPE_OPERATOR && ($curr->value === '.' || $curr->value === ',' || $curr->value === '(' || $curr->value === ')')) // No space before . , ( ) - || $curr->type === Token::TYPE_DELIMITER && mb_strlen($curr->value, 'UTF-8') < 2 + || $curr->type === Token::TYPE_DELIMITER && mb_strlen((string) $curr->value, 'UTF-8') < 2 ) ) { $ret .= ' '; @@ -706,7 +706,7 @@ class Formatter } // Keeping track of this group's length. - $length += mb_strlen($list->tokens[$idx]->value, 'UTF-8'); + $length += mb_strlen((string) $list->tokens[$idx]->value, 'UTF-8'); } return $length; diff --git a/src/Utils/Misc.php b/src/Utils/Misc.php index aa9e13a..9e3ae02 100644 --- a/src/Utils/Misc.php +++ b/src/Utils/Misc.php @@ -1,8 +1,8 @@ <?php - /** * Miscellaneous utilities. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Utils; diff --git a/src/Utils/Query.php b/src/Utils/Query.php index 1416629..662404b 100644 --- a/src/Utils/Query.php +++ b/src/Utils/Query.php @@ -1,8 +1,8 @@ <?php - /** * Statement utilities. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Utils; diff --git a/src/Utils/Routine.php b/src/Utils/Routine.php index 50f319a..9842ff1 100644 --- a/src/Utils/Routine.php +++ b/src/Utils/Routine.php @@ -1,8 +1,8 @@ <?php - /** * Routine utilities. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Utils; diff --git a/src/Utils/Table.php b/src/Utils/Table.php index 49e3f35..140ed2a 100644 --- a/src/Utils/Table.php +++ b/src/Utils/Table.php @@ -1,8 +1,8 @@ <?php - /** * Table utilities. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Utils; diff --git a/src/Utils/Tokens.php b/src/Utils/Tokens.php index cde1a79..b7f5935 100644 --- a/src/Utils/Tokens.php +++ b/src/Utils/Tokens.php @@ -1,8 +1,8 @@ <?php - /** * Token utilities. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Utils; @@ -44,7 +44,7 @@ class Tokens } if (isset($pattern['value_str']) - && strcasecmp($pattern['value_str'], $token->value) + && strcasecmp($pattern['value_str'], (string) $token->value) ) { return false; } diff --git a/tests/Builder/AlterStatementTest.php b/tests/Builder/AlterStatementTest.php index 2372b6d..70236e4 100644 --- a/tests/Builder/AlterStatementTest.php +++ b/tests/Builder/AlterStatementTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Builder; diff --git a/tests/Builder/CreateStatementTest.php b/tests/Builder/CreateStatementTest.php index 6facd88..328d381 100644 --- a/tests/Builder/CreateStatementTest.php +++ b/tests/Builder/CreateStatementTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Builder; diff --git a/tests/Builder/DeleteStatementTest.php b/tests/Builder/DeleteStatementTest.php index 5aa037e..0327e03 100644 --- a/tests/Builder/DeleteStatementTest.php +++ b/tests/Builder/DeleteStatementTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Builder; diff --git a/tests/Builder/ExplainStatement.php b/tests/Builder/ExplainStatement.php index 44bb817..7b6215f 100644 --- a/tests/Builder/ExplainStatement.php +++ b/tests/Builder/ExplainStatement.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Builder; diff --git a/tests/Builder/InsertStatementTest.php b/tests/Builder/InsertStatementTest.php index 50a04d4..a2b2ef8 100644 --- a/tests/Builder/InsertStatementTest.php +++ b/tests/Builder/InsertStatementTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Builder; diff --git a/tests/Builder/LoadStatementTest.php b/tests/Builder/LoadStatementTest.php index 4c4e9b1..051e13d 100644 --- a/tests/Builder/LoadStatementTest.php +++ b/tests/Builder/LoadStatementTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Builder; diff --git a/tests/Builder/LockStatementTest.php b/tests/Builder/LockStatementTest.php index b0b4d38..8593a87 100644 --- a/tests/Builder/LockStatementTest.php +++ b/tests/Builder/LockStatementTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Builder; diff --git a/tests/Builder/PurgeStatementTest.php b/tests/Builder/PurgeStatementTest.php index caa1652..aae52b5 100644 --- a/tests/Builder/PurgeStatementTest.php +++ b/tests/Builder/PurgeStatementTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Builder; diff --git a/tests/Builder/RenameStatementTest.php b/tests/Builder/RenameStatementTest.php index 97852ab..e803786 100644 --- a/tests/Builder/RenameStatementTest.php +++ b/tests/Builder/RenameStatementTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Builder; diff --git a/tests/Builder/ReplaceStatementTest.php b/tests/Builder/ReplaceStatementTest.php index f96bd43..2610ac0 100644 --- a/tests/Builder/ReplaceStatementTest.php +++ b/tests/Builder/ReplaceStatementTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Builder; diff --git a/tests/Builder/SelectStatementTest.php b/tests/Builder/SelectStatementTest.php index 614c561..eaf80c3 100644 --- a/tests/Builder/SelectStatementTest.php +++ b/tests/Builder/SelectStatementTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Builder; diff --git a/tests/Builder/SetStatementTest.php b/tests/Builder/SetStatementTest.php index 746e92f..406e369 100644 --- a/tests/Builder/SetStatementTest.php +++ b/tests/Builder/SetStatementTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Builder; diff --git a/tests/Builder/StatementTest.php b/tests/Builder/StatementTest.php index 42e9a57..da16602 100644 --- a/tests/Builder/StatementTest.php +++ b/tests/Builder/StatementTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Builder; diff --git a/tests/Builder/TransactionStatementTest.php b/tests/Builder/TransactionStatementTest.php index b35d2ea..4bdfe70 100644 --- a/tests/Builder/TransactionStatementTest.php +++ b/tests/Builder/TransactionStatementTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Builder; diff --git a/tests/Components/Array2dTest.php b/tests/Components/Array2dTest.php index 2e2cf6b..3413f8a 100644 --- a/tests/Components/Array2dTest.php +++ b/tests/Components/Array2dTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Components; diff --git a/tests/Components/ArrayObjTest.php b/tests/Components/ArrayObjTest.php index ccef92f..f32173c 100644 --- a/tests/Components/ArrayObjTest.php +++ b/tests/Components/ArrayObjTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Components; diff --git a/tests/Components/CaseExpressionTest.php b/tests/Components/CaseExpressionTest.php index 52078ef..cb9290c 100644 --- a/tests/Components/CaseExpressionTest.php +++ b/tests/Components/CaseExpressionTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Components; diff --git a/tests/Components/ComponentTest.php b/tests/Components/ComponentTest.php index 8686160..fec0f56 100644 --- a/tests/Components/ComponentTest.php +++ b/tests/Components/ComponentTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Parser; diff --git a/tests/Components/ConditionTest.php b/tests/Components/ConditionTest.php index 27c6a4f..eb8cca1 100644 --- a/tests/Components/ConditionTest.php +++ b/tests/Components/ConditionTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Components; diff --git a/tests/Components/CreateDefinitionTest.php b/tests/Components/CreateDefinitionTest.php index 3683e29..6b97cb1 100644 --- a/tests/Components/CreateDefinitionTest.php +++ b/tests/Components/CreateDefinitionTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Components; diff --git a/tests/Components/ExpressionArrayTest.php b/tests/Components/ExpressionArrayTest.php index ede3954..597d0a3 100644 --- a/tests/Components/ExpressionArrayTest.php +++ b/tests/Components/ExpressionArrayTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Components; diff --git a/tests/Components/ExpressionTest.php b/tests/Components/ExpressionTest.php index 943aa6a..ae7f0f6 100644 --- a/tests/Components/ExpressionTest.php +++ b/tests/Components/ExpressionTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Components; diff --git a/tests/Components/FunctionCallTest.php b/tests/Components/FunctionCallTest.php index 20ac4c6..386b220 100644 --- a/tests/Components/FunctionCallTest.php +++ b/tests/Components/FunctionCallTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Components; diff --git a/tests/Components/GroupKeywordTest.php b/tests/Components/GroupKeywordTest.php index aa88c60..41ff89a 100644 --- a/tests/Components/GroupKeywordTest.php +++ b/tests/Components/GroupKeywordTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Components; diff --git a/tests/Components/IntoKeywordTest.php b/tests/Components/IntoKeywordTest.php index 2ebf5ee..896c363 100644 --- a/tests/Components/IntoKeywordTest.php +++ b/tests/Components/IntoKeywordTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Components; diff --git a/tests/Components/JoinKeywordTest.php b/tests/Components/JoinKeywordTest.php index 9e8b85f..91fd4a6 100644 --- a/tests/Components/JoinKeywordTest.php +++ b/tests/Components/JoinKeywordTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Components; diff --git a/tests/Components/KeyTest.php b/tests/Components/KeyTest.php index c27b9d8..aeb403d 100644 --- a/tests/Components/KeyTest.php +++ b/tests/Components/KeyTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Components; diff --git a/tests/Components/LimitTest.php b/tests/Components/LimitTest.php index 8d336b2..f7bbbce 100644 --- a/tests/Components/LimitTest.php +++ b/tests/Components/LimitTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Components; diff --git a/tests/Components/LockExpressionTest.php b/tests/Components/LockExpressionTest.php index 0f8e418..7f26c5e 100644 --- a/tests/Components/LockExpressionTest.php +++ b/tests/Components/LockExpressionTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Components; diff --git a/tests/Components/OptionsArrayTest.php b/tests/Components/OptionsArrayTest.php index c5b6eb7..3904fdf 100644 --- a/tests/Components/OptionsArrayTest.php +++ b/tests/Components/OptionsArrayTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Components; diff --git a/tests/Components/OrderKeywordTest.php b/tests/Components/OrderKeywordTest.php index ffacfd4..11468fb 100644 --- a/tests/Components/OrderKeywordTest.php +++ b/tests/Components/OrderKeywordTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Components; diff --git a/tests/Components/ParameterDefinitionTest.php b/tests/Components/ParameterDefinitionTest.php index 683eb3a..38d28e0 100644 --- a/tests/Components/ParameterDefinitionTest.php +++ b/tests/Components/ParameterDefinitionTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Components; diff --git a/tests/Components/PartitionDefinitionTest.php b/tests/Components/PartitionDefinitionTest.php index 7edc21e..93bc4d5 100644 --- a/tests/Components/PartitionDefinitionTest.php +++ b/tests/Components/PartitionDefinitionTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Components; diff --git a/tests/Components/ReferenceTest.php b/tests/Components/ReferenceTest.php index 178776c..19768c7 100644 --- a/tests/Components/ReferenceTest.php +++ b/tests/Components/ReferenceTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Components; diff --git a/tests/Components/RenameOperationTest.php b/tests/Components/RenameOperationTest.php index 919c4bd..6f38605 100644 --- a/tests/Components/RenameOperationTest.php +++ b/tests/Components/RenameOperationTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Components; diff --git a/tests/Lexer/ContextTest.php b/tests/Lexer/ContextTest.php index d822cd3..47bd10a 100644 --- a/tests/Lexer/ContextTest.php +++ b/tests/Lexer/ContextTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Lexer; diff --git a/tests/Lexer/IsMethodsTest.php b/tests/Lexer/IsMethodsTest.php index 56552c7..9095907 100644 --- a/tests/Lexer/IsMethodsTest.php +++ b/tests/Lexer/IsMethodsTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Lexer; diff --git a/tests/Lexer/LexerTest.php b/tests/Lexer/LexerTest.php index 353e80a..f5276af 100644 --- a/tests/Lexer/LexerTest.php +++ b/tests/Lexer/LexerTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Lexer; diff --git a/tests/Lexer/TokenTest.php b/tests/Lexer/TokenTest.php index 535f933..370824e 100644 --- a/tests/Lexer/TokenTest.php +++ b/tests/Lexer/TokenTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Lexer; diff --git a/tests/Lexer/TokensListTest.php b/tests/Lexer/TokensListTest.php index 4bb844a..a03bfad 100644 --- a/tests/Lexer/TokensListTest.php +++ b/tests/Lexer/TokensListTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Lexer; diff --git a/tests/Misc/BugsTest.php b/tests/Misc/BugsTest.php index 5dbb861..3065308 100644 --- a/tests/Misc/BugsTest.php +++ b/tests/Misc/BugsTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Parser; diff --git a/tests/Misc/ParameterTest.php b/tests/Misc/ParameterTest.php index fa6b79c..a8b2f9b 100644 --- a/tests/Misc/ParameterTest.php +++ b/tests/Misc/ParameterTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Misc; diff --git a/tests/Misc/UtfStringTest.php b/tests/Misc/UtfStringTest.php index afa3b0c..d2c4dbf 100644 --- a/tests/Misc/UtfStringTest.php +++ b/tests/Misc/UtfStringTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Misc; diff --git a/tests/Parser/AlterStatementTest.php b/tests/Parser/AlterStatementTest.php index 4582a23..1680d4d 100644 --- a/tests/Parser/AlterStatementTest.php +++ b/tests/Parser/AlterStatementTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Parser; diff --git a/tests/Parser/CallStatementTest.php b/tests/Parser/CallStatementTest.php index 0bb34e1..671a9f9 100644 --- a/tests/Parser/CallStatementTest.php +++ b/tests/Parser/CallStatementTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Parser; diff --git a/tests/Parser/CreateStatementTest.php b/tests/Parser/CreateStatementTest.php index 1ac1ddc..56c3c72 100644 --- a/tests/Parser/CreateStatementTest.php +++ b/tests/Parser/CreateStatementTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Parser; diff --git a/tests/Parser/DeleteStatementTest.php b/tests/Parser/DeleteStatementTest.php index 348d666..ecfe9f4 100644 --- a/tests/Parser/DeleteStatementTest.php +++ b/tests/Parser/DeleteStatementTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Parser; diff --git a/tests/Parser/ExplainStatement.php b/tests/Parser/ExplainStatement.php index 804a0e4..2001bed 100644 --- a/tests/Parser/ExplainStatement.php +++ b/tests/Parser/ExplainStatement.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Parser; diff --git a/tests/Parser/InsertStatementTest.php b/tests/Parser/InsertStatementTest.php index 396b6c4..a1b097c 100644 --- a/tests/Parser/InsertStatementTest.php +++ b/tests/Parser/InsertStatementTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Parser; diff --git a/tests/Parser/LoadStatementTest.php b/tests/Parser/LoadStatementTest.php index f18dcf6..41e947b 100644 --- a/tests/Parser/LoadStatementTest.php +++ b/tests/Parser/LoadStatementTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Parser; diff --git a/tests/Parser/LockStatementTest.php b/tests/Parser/LockStatementTest.php index 0f7a416..19b778e 100644 --- a/tests/Parser/LockStatementTest.php +++ b/tests/Parser/LockStatementTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Parser; diff --git a/tests/Parser/ParserTest.php b/tests/Parser/ParserTest.php index 16dcbf9..3f37072 100644 --- a/tests/Parser/ParserTest.php +++ b/tests/Parser/ParserTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Parser; diff --git a/tests/Parser/PurgeStatementTest.php b/tests/Parser/PurgeStatementTest.php index 8716cb4..deca5c5 100644 --- a/tests/Parser/PurgeStatementTest.php +++ b/tests/Parser/PurgeStatementTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Parser; diff --git a/tests/Parser/RenameStatementTest.php b/tests/Parser/RenameStatementTest.php index 47db80e..84253bd 100644 --- a/tests/Parser/RenameStatementTest.php +++ b/tests/Parser/RenameStatementTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Parser; diff --git a/tests/Parser/ReplaceStatementTest.php b/tests/Parser/ReplaceStatementTest.php index 9745ada..ba304d8 100644 --- a/tests/Parser/ReplaceStatementTest.php +++ b/tests/Parser/ReplaceStatementTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Parser; diff --git a/tests/Parser/RestoreStatementTest.php b/tests/Parser/RestoreStatementTest.php index d8b73dc..1f2a308 100644 --- a/tests/Parser/RestoreStatementTest.php +++ b/tests/Parser/RestoreStatementTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Parser; diff --git a/tests/Parser/SelectStatementTest.php b/tests/Parser/SelectStatementTest.php index cc860f0..8c1af98 100644 --- a/tests/Parser/SelectStatementTest.php +++ b/tests/Parser/SelectStatementTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Parser; diff --git a/tests/Parser/SetStatementTest.php b/tests/Parser/SetStatementTest.php index b3ae9c2..7c767a5 100644 --- a/tests/Parser/SetStatementTest.php +++ b/tests/Parser/SetStatementTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Parser; diff --git a/tests/Parser/TransactionStatementTest.php b/tests/Parser/TransactionStatementTest.php index 6234f17..b72a21b 100644 --- a/tests/Parser/TransactionStatementTest.php +++ b/tests/Parser/TransactionStatementTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Parser; diff --git a/tests/Parser/UpdateStatementTest.php b/tests/Parser/UpdateStatementTest.php index 8a47f44..448be52 100644 --- a/tests/Parser/UpdateStatementTest.php +++ b/tests/Parser/UpdateStatementTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Parser; diff --git a/tests/TestCase.php b/tests/TestCase.php index cb925e1..71febab 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -1,8 +1,8 @@ <?php - /** * Bootstrap for tests. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests; diff --git a/tests/Utils/BufferedQueryTest.php b/tests/Utils/BufferedQueryTest.php index f31dd78..bbf886f 100644 --- a/tests/Utils/BufferedQueryTest.php +++ b/tests/Utils/BufferedQueryTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Utils; diff --git a/tests/Utils/CLITest.php b/tests/Utils/CLITest.php index ebcd35e..bacf5fb 100644 --- a/tests/Utils/CLITest.php +++ b/tests/Utils/CLITest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Utils; diff --git a/tests/Utils/ErrorTest.php b/tests/Utils/ErrorTest.php index d7d1393..7e1326f 100644 --- a/tests/Utils/ErrorTest.php +++ b/tests/Utils/ErrorTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Utils; diff --git a/tests/Utils/FormatterTest.php b/tests/Utils/FormatterTest.php index 152359e..7776a8e 100644 --- a/tests/Utils/FormatterTest.php +++ b/tests/Utils/FormatterTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Utils; diff --git a/tests/Utils/MiscTest.php b/tests/Utils/MiscTest.php index 01a2926..dbd200e 100644 --- a/tests/Utils/MiscTest.php +++ b/tests/Utils/MiscTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Utils; diff --git a/tests/Utils/QueryTest.php b/tests/Utils/QueryTest.php index 6991870..0d62915 100644 --- a/tests/Utils/QueryTest.php +++ b/tests/Utils/QueryTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Utils; diff --git a/tests/Utils/RoutineTest.php b/tests/Utils/RoutineTest.php index 9a7c4ca..81a8325 100644 --- a/tests/Utils/RoutineTest.php +++ b/tests/Utils/RoutineTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Utils; diff --git a/tests/Utils/TableTest.php b/tests/Utils/TableTest.php index fe68100..9d5d3b0 100644 --- a/tests/Utils/TableTest.php +++ b/tests/Utils/TableTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Utils; diff --git a/tests/Utils/TokensTest.php b/tests/Utils/TokensTest.php index 533021c..200dfe6 100644 --- a/tests/Utils/TokensTest.php +++ b/tests/Utils/TokensTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Utils; diff --git a/tools/ContextGenerator.php b/tools/ContextGenerator.php index 5c6b747..ac24156 100644 --- a/tools/ContextGenerator.php +++ b/tools/ContextGenerator.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tools; @@ -56,7 +57,6 @@ class ContextGenerator */ const TEMPLATE = '<?php' . "\n" . - '' . "\n" . '/**' . "\n" . ' * Context for %1$s.' . "\n" . ' *' . "\n" . @@ -64,6 +64,7 @@ class ContextGenerator ' *' . "\n" . ' * @see %3$s' . "\n" . ' */' . "\n" . + 'declare(strict_types=1);' . "\n" . '' . "\n" . 'namespace PhpMyAdmin\\SqlParser\\Contexts;' . "\n" . '' . "\n" . @@ -90,9 +91,9 @@ class ContextGenerator ' *' . "\n" . ' * @var array' . "\n" . ' */' . "\n" . - ' public static $KEYWORDS = array(' . "\n" . + ' public static $KEYWORDS = [' . "\n" . '%4$s' . - ' );' . "\n" . + ' ];' . "\n" . '}' . "\n"; /** diff --git a/tools/TestGenerator.php b/tools/TestGenerator.php index 599387f..d52e708 100644 --- a/tools/TestGenerator.php +++ b/tools/TestGenerator.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tools; |