From 746f48fae61c7a21951d51c5823869ebb43d7da1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Tue, 28 Dec 2021 13:33:01 -0300 Subject: [PATCH] Add missing return types annotations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MaurĂ­cio Meneghini Fauth --- CHANGELOG.md | 2 + phpstan-baseline.neon | 170 ------------------------ psalm-baseline.xml | 90 +------------ src/Components/OptionsArray.php | 2 + src/Context.php | 7 +- src/Core.php | 2 + src/Lexer.php | 6 + src/Parser.php | 4 + src/Statement.php | 6 + src/Statements/MaintenanceStatement.php | 2 + src/Statements/RenameStatement.php | 2 + src/Statements/ReplaceStatement.php | 2 + src/Statements/TransactionStatement.php | 2 + src/Statements/WithStatement.php | 2 + src/TokensList.php | 2 + src/Tools/ContextGenerator.php | 4 + src/Tools/TestGenerator.php | 4 + src/Translator.php | 2 + src/Utils/BufferedQuery.php | 2 + tests/TestCase.php | 2 +- tests/Utils/BufferedQueryTest.php | 2 +- 21 files changed, 54 insertions(+), 263 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 58ca78141..4ebd80f15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## [5.6.0] - YYYY-MM-DD +* Add missing return types annotations + ## [5.5.0] - 2021-12-08 * Add WITH support (#165, #331) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 901a0eb79..03c25d684 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -760,11 +760,6 @@ parameters: count: 1 path: src/Components/OptionsArray.php - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Components\\\\OptionsArray\\:\\:merge\\(\\) has no return type specified\\.$#" - count: 1 - path: src/Components/OptionsArray.php - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Components\\\\OptionsArray\\:\\:merge\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" count: 1 @@ -1000,16 +995,6 @@ parameters: count: 1 path: src/Context.php - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Context\\:\\:load\\(\\) has no return type specified\\.$#" - count: 1 - path: src/Context.php - - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Context\\:\\:setMode\\(\\) has no return type specified\\.$#" - count: 1 - path: src/Context.php - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Context\\:\\:\\$KEYWORDS type has no value type specified in iterable type array\\.$#" count: 1 @@ -1020,31 +1005,11 @@ parameters: count: 1 path: src/Context.php - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Core\\:\\:error\\(\\) has no return type specified\\.$#" - count: 1 - path: src/Core.php - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Exceptions\\\\ParserException\\:\\:\\$token \\(PhpMyAdmin\\\\SqlParser\\\\Token\\) does not accept PhpMyAdmin\\\\SqlParser\\\\Token\\|null\\.$#" count: 1 path: src/Exceptions/ParserException.php - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Lexer\\:\\:error\\(\\) has no return type specified\\.$#" - count: 1 - path: src/Lexer.php - - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Lexer\\:\\:lex\\(\\) has no return type specified\\.$#" - count: 1 - path: src/Lexer.php - - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Lexer\\:\\:setDelimiter\\(\\) has no return type specified\\.$#" - count: 1 - path: src/Lexer.php - - message: "#^Parameter \\#1 \\$msg \\(string\\) of method PhpMyAdmin\\\\SqlParser\\\\Lexer\\:\\:error\\(\\) should be compatible with parameter \\$error \\(Exception\\) of method PhpMyAdmin\\\\SqlParser\\\\Core\\:\\:error\\(\\)$#" count: 1 @@ -1075,16 +1040,6 @@ parameters: count: 1 path: src/Parser.php - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Parser\\:\\:error\\(\\) has no return type specified\\.$#" - count: 1 - path: src/Parser.php - - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Parser\\:\\:parse\\(\\) has no return type specified\\.$#" - count: 1 - path: src/Parser.php - - message: "#^Parameter \\#1 \\$msg \\(string\\) of method PhpMyAdmin\\\\SqlParser\\\\Parser\\:\\:error\\(\\) should be compatible with parameter \\$error \\(Exception\\) of method PhpMyAdmin\\\\SqlParser\\\\Core\\:\\:error\\(\\)$#" count: 1 @@ -1105,26 +1060,11 @@ parameters: count: 1 path: src/Parser.php - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Statement\\:\\:after\\(\\) has no return type specified\\.$#" - count: 1 - path: src/Statement.php - - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Statement\\:\\:before\\(\\) has no return type specified\\.$#" - count: 1 - path: src/Statement.php - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Statement\\:\\:getClauses\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 path: src/Statement.php - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Statement\\:\\:parse\\(\\) has no return type specified\\.$#" - count: 1 - path: src/Statement.php - - message: "#^PHPDoc tag @var has no value type specified in iterable type array\\.$#" count: 4 @@ -1150,11 +1090,6 @@ parameters: count: 1 path: src/Statement.php - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Statements\\\\AlterStatement\\:\\:parse\\(\\) has no return type specified\\.$#" - count: 1 - path: src/Statements/AlterStatement.php - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Statements\\\\AlterStatement\\:\\:\\$OPTIONS type has no value type specified in iterable type array\\.$#" count: 1 @@ -1200,11 +1135,6 @@ parameters: count: 4 path: src/Statements/CreateStatement.php - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Statements\\\\CreateStatement\\:\\:parse\\(\\) has no return type specified\\.$#" - count: 1 - path: src/Statements/CreateStatement.php - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Statements\\\\CreateStatement\\:\\:\\$DB_OPTIONS type has no value type specified in iterable type array\\.$#" count: 1 @@ -1280,11 +1210,6 @@ parameters: count: 1 path: src/Statements/CreateStatement.php - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Statements\\\\DeleteStatement\\:\\:parse\\(\\) has no return type specified\\.$#" - count: 1 - path: src/Statements/DeleteStatement.php - - message: "#^Parameter \\#1 \\$component of static method PhpMyAdmin\\\\SqlParser\\\\Components\\\\ExpressionArray\\:\\:build\\(\\) expects array\\, array\\ given\\.$#" count: 1 @@ -1320,11 +1245,6 @@ parameters: count: 1 path: src/Statements/DropStatement.php - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Statements\\\\InsertStatement\\:\\:parse\\(\\) has no return type specified\\.$#" - count: 1 - path: src/Statements/InsertStatement.php - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Statements\\\\InsertStatement\\:\\:\\$OPTIONS type has no value type specified in iterable type array\\.$#" count: 1 @@ -1345,11 +1265,6 @@ parameters: count: 1 path: src/Statements/LoadStatement.php - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Statements\\\\LoadStatement\\:\\:parse\\(\\) has no return type specified\\.$#" - count: 1 - path: src/Statements/LoadStatement.php - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Statements\\\\LoadStatement\\:\\:\\$FIELDS_OPTIONS type has no value type specified in iterable type array\\.$#" count: 1 @@ -1390,31 +1305,11 @@ parameters: count: 1 path: src/Statements/LoadStatement.php - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Statements\\\\LockStatement\\:\\:parse\\(\\) has no return type specified\\.$#" - count: 1 - path: src/Statements/LockStatement.php - - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Statements\\\\MaintenanceStatement\\:\\:after\\(\\) has no return type specified\\.$#" - count: 1 - path: src/Statements/MaintenanceStatement.php - - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Statements\\\\NotImplementedStatement\\:\\:parse\\(\\) has no return type specified\\.$#" - count: 1 - path: src/Statements/NotImplementedStatement.php - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Statements\\\\OptimizeStatement\\:\\:\\$OPTIONS type has no value type specified in iterable type array\\.$#" count: 1 path: src/Statements/OptimizeStatement.php - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Statements\\\\PurgeStatement\\:\\:parse\\(\\) has no return type specified\\.$#" - count: 1 - path: src/Statements/PurgeStatement.php - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Statements\\\\PurgeStatement\\:\\:parseExpectedKeyword\\(\\) has parameter \\$expectedKeywords with no value type specified in iterable type array\\.$#" count: 1 @@ -1435,11 +1330,6 @@ parameters: count: 1 path: src/Statements/PurgeStatement.php - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Statements\\\\RenameStatement\\:\\:before\\(\\) has no return type specified\\.$#" - count: 1 - path: src/Statements/RenameStatement.php - - message: "#^Parameter \\#1 \\$component of static method PhpMyAdmin\\\\SqlParser\\\\Components\\\\RenameOperation\\:\\:build\\(\\) expects PhpMyAdmin\\\\SqlParser\\\\Components\\\\RenameOperation, array\\ given\\.$#" count: 1 @@ -1450,11 +1340,6 @@ parameters: count: 1 path: src/Statements/RepairStatement.php - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Statements\\\\ReplaceStatement\\:\\:parse\\(\\) has no return type specified\\.$#" - count: 1 - path: src/Statements/ReplaceStatement.php - - message: "#^Parameter \\#1 \\$component of static method PhpMyAdmin\\\\SqlParser\\\\Components\\\\Array2d\\:\\:build\\(\\) expects array\\, PhpMyAdmin\\\\SqlParser\\\\Components\\\\Array2d given\\.$#" count: 1 @@ -1525,11 +1410,6 @@ parameters: count: 1 path: src/Statements/ShowStatement.php - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Statements\\\\TransactionStatement\\:\\:parse\\(\\) has no return type specified\\.$#" - count: 1 - path: src/Statements/TransactionStatement.php - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Statements\\\\TransactionStatement\\:\\:\\$OPTIONS type has no value type specified in iterable type array\\.$#" count: 1 @@ -1550,11 +1430,6 @@ parameters: count: 1 path: src/Statements/UpdateStatement.php - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Statements\\\\WithStatement\\:\\:parse\\(\\) has no return type specified\\.$#" - count: 1 - path: src/Statements/WithStatement.php - - message: "#^Parameter \\#1 \\$name of class PhpMyAdmin\\\\SqlParser\\\\Components\\\\WithKeyword constructor expects string, mixed given\\.$#" count: 1 @@ -1570,11 +1445,6 @@ parameters: count: 1 path: src/TokensList.php - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\TokensList\\:\\:add\\(\\) has no return type specified\\.$#" - count: 1 - path: src/TokensList.php - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\TokensList\\:\\:\\$tokens type has no value type specified in iterable type array\\.$#" count: 1 @@ -1595,16 +1465,6 @@ parameters: count: 1 path: src/Tools/ContextGenerator.php - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Tools\\\\ContextGenerator\\:\\:build\\(\\) has no return type specified\\.$#" - count: 1 - path: src/Tools/ContextGenerator.php - - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Tools\\\\ContextGenerator\\:\\:buildAll\\(\\) has no return type specified\\.$#" - count: 1 - path: src/Tools/ContextGenerator.php - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Tools\\\\ContextGenerator\\:\\:generate\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" count: 1 @@ -1655,16 +1515,6 @@ parameters: count: 2 path: src/Tools/TestGenerator.php - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Tools\\\\TestGenerator\\:\\:build\\(\\) has no return type specified\\.$#" - count: 1 - path: src/Tools/TestGenerator.php - - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Tools\\\\TestGenerator\\:\\:buildAll\\(\\) has no return type specified\\.$#" - count: 1 - path: src/Tools/TestGenerator.php - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Tools\\\\TestGenerator\\:\\:generate\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -1690,11 +1540,6 @@ parameters: count: 1 path: src/Tools/TestGenerator.php - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Translator\\:\\:load\\(\\) has no return type specified\\.$#" - count: 1 - path: src/Translator.php - - message: "#^Class PhpMyAdmin\\\\SqlParser\\\\UtfString implements generic interface ArrayAccess but does not specify its types\\: TKey, TValue$#" count: 1 @@ -1705,11 +1550,6 @@ parameters: count: 1 path: src/Utils/BufferedQuery.php - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Utils\\\\BufferedQuery\\:\\:setDelimiter\\(\\) has no return type specified\\.$#" - count: 1 - path: src/Utils/BufferedQuery.php - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Utils\\\\BufferedQuery\\:\\:\\$options type has no value type specified in iterable type array\\.$#" count: 1 @@ -2460,11 +2300,6 @@ parameters: count: 1 path: tests/TestCase.php - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Tests\\\\TestCase\\:\\:runParserTest\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/TestCase.php - - message: "#^PHPDoc tag @var has no value type specified in iterable type array\\.$#" count: 1 @@ -2480,11 +2315,6 @@ parameters: count: 1 path: tests/Utils/BufferedQueryTest.php - - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Tests\\\\Utils\\\\BufferedQueryTest\\:\\:testExtract\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Utils/BufferedQueryTest.php - - message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Tests\\\\Utils\\\\BufferedQueryTest\\:\\:testExtract\\(\\) has parameter \\$expected with no value type specified in iterable type array\\.$#" count: 1 diff --git a/psalm-baseline.xml b/psalm-baseline.xml index d5836fb98..987e599ce 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + static::build($this) @@ -478,9 +478,6 @@ - - merge - $list->tokens[$list->idx - 1] $option @@ -693,10 +690,6 @@ $context::$KEYWORDS - - load - setMode - $value @@ -796,11 +789,6 @@ - - - error - - $token @@ -812,11 +800,6 @@ $this->last $this->last - - error - lex - setDelimiter - $this->str[$this->last + 1] $this->str[$this->last + 1] @@ -970,10 +953,6 @@ new $class($this, $this->list) - - error - parse - static::$STATEMENT_PARSERS[$token->keyword] @@ -994,11 +973,6 @@ count($clauses) === 0 - - after - before - parse - $options $token @@ -1057,9 +1031,6 @@ - - parse - $table @@ -1117,9 +1088,6 @@ $this->name === '' $this->name === '' - - parse - $list->tokens[$list->idx] $list->tokens[$list->idx] @@ -1197,9 +1165,6 @@ $this->order - - parse - $token->keyword @@ -1244,9 +1209,6 @@ - - parse - $into $onDuplicateSet @@ -1262,9 +1224,6 @@ - - parse - $token->value @@ -1321,9 +1280,6 @@ - - parse - $list->tokens[$list->idx]->value @@ -1334,9 +1290,6 @@ - - after - $tables MaintenanceStatement @@ -1344,9 +1297,6 @@ - - parse - $list->tokens[$list->idx]->type @@ -1373,9 +1323,6 @@ Expression::parse($parser, $list, []) - - parse - $this->end_option $this->log_type @@ -1399,9 +1346,6 @@ $this->renames - - before - $renames RenameStatement @@ -1423,9 +1367,6 @@ Array2d::parse($parser, $list) - - parse - $into $select @@ -1489,9 +1430,6 @@ - - parse - $end $statements @@ -1519,9 +1457,6 @@ - - parse - $token $wither @@ -1551,9 +1486,6 @@ $offset === null - - add - $tok @@ -1587,10 +1519,6 @@ - - build - buildAll - $options['class'] $options['keywords'] @@ -1647,10 +1575,6 @@ - - build - buildAll - $debug @@ -1670,17 +1594,11 @@ self::$loader === null - - load - self::$translator !== null - - setDelimiter - $this->options['delimiter'] @@ -2361,9 +2279,6 @@ - - runParserTest - $data['query'] @@ -2393,9 +2308,6 @@ - - testExtract - $chunkSize $query diff --git a/src/Components/OptionsArray.php b/src/Components/OptionsArray.php index 9a9d067d7..88fd2bc5b 100644 --- a/src/Components/OptionsArray.php +++ b/src/Components/OptionsArray.php @@ -364,6 +364,8 @@ public function remove($key) * replaced. * * @param array|OptionsArray $options the options to be merged + * + * @return void */ public function merge($options) { diff --git a/src/Context.php b/src/Context.php index 5c32c8c58..8fed16ec0 100644 --- a/src/Context.php +++ b/src/Context.php @@ -490,8 +490,9 @@ public static function isSeparator($str) * * Contexts may be used by accessing the context directly. * - * @param string $context name of the context or full class name that - * defines the context + * @param string $context name of the context or full class name that defines the context + * + * @return void * * @throws LoaderException if the specified context doesn't exist. */ @@ -567,6 +568,8 @@ public static function loadClosest($context = '') * Sets the SQL mode. * * @param string $mode The list of modes. If empty, the mode is reset. + * + * @return void */ public static function setMode($mode = '') { diff --git a/src/Core.php b/src/Core.php index e52992077..ba3654434 100644 --- a/src/Core.php +++ b/src/Core.php @@ -38,6 +38,8 @@ class Core * * @param Exception $error the error exception * + * @return void + * * @throws Exception throws the exception, if strict mode is enabled. */ public function error($error) diff --git a/src/Lexer.php b/src/Lexer.php index 9e905f524..688b1cd97 100644 --- a/src/Lexer.php +++ b/src/Lexer.php @@ -195,6 +195,8 @@ public function __construct($str, $strict = false, $delimiter = null) * Sets the delimiter. * * @param string $delimiter the new delimiter + * + * @return void */ public function setDelimiter($delimiter) { @@ -204,6 +206,8 @@ public function setDelimiter($delimiter) /** * Parses the string and extracts lexemes. + * + * @return void */ public function lex() { @@ -390,6 +394,8 @@ private function solveAmbiguityOnStarOperator() * @param int $pos the position of the character * @param int $code the code of the error * + * @return void + * * @throws LexerException throws the exception, if strict mode is enabled. */ public function error($msg, $str = '', $pos = 0, $code = 0) diff --git a/src/Parser.php b/src/Parser.php index 7fe27d748..a990bd706 100644 --- a/src/Parser.php +++ b/src/Parser.php @@ -381,6 +381,8 @@ public function __construct($list = null, $strict = false) /** * Builds the parse trees. * + * @return void + * * @throws ParserException */ public function parse() @@ -596,6 +598,8 @@ public function parse() * @param Token $token the token that produced the error * @param int $code the code of the error * + * @return void + * * @throws ParserException throws the exception, if strict mode is enabled. */ public function error($msg, ?Token $token = null, $code = 0) diff --git a/src/Statement.php b/src/Statement.php index 10c609a1c..a0b0b8629 100644 --- a/src/Statement.php +++ b/src/Statement.php @@ -202,6 +202,8 @@ public function build() * @param Parser $parser the instance that requests parsing * @param TokensList $list the list of tokens to be parsed * + * @return void + * * @throws Exceptions\ParserException */ public function parse(Parser $parser, TokensList $list) @@ -427,6 +429,8 @@ public function parse(Parser $parser, TokensList $list) * @param Parser $parser the instance that requests parsing * @param TokensList $list the list of tokens to be parsed * @param Token $token the token that is being parsed + * + * @return void */ public function before(Parser $parser, TokensList $list, Token $token) { @@ -438,6 +442,8 @@ public function before(Parser $parser, TokensList $list, Token $token) * @param Parser $parser the instance that requests parsing * @param TokensList $list the list of tokens to be parsed * @param Token $token the token that is being parsed + * + * @return void */ public function after(Parser $parser, TokensList $list, Token $token) { diff --git a/src/Statements/MaintenanceStatement.php b/src/Statements/MaintenanceStatement.php index 1f3f71b8a..c0a0c2819 100644 --- a/src/Statements/MaintenanceStatement.php +++ b/src/Statements/MaintenanceStatement.php @@ -37,6 +37,8 @@ class MaintenanceStatement extends Statement * @param Parser $parser the instance that requests parsing * @param TokensList $list the list of tokens to be parsed * @param Token $token the token that is being parsed + * + * @return void */ public function after(Parser $parser, TokensList $list, Token $token) { diff --git a/src/Statements/RenameStatement.php b/src/Statements/RenameStatement.php index b7b91cfc1..ae533a0ea 100644 --- a/src/Statements/RenameStatement.php +++ b/src/Statements/RenameStatement.php @@ -36,6 +36,8 @@ class RenameStatement extends Statement * @param Parser $parser the instance that requests parsing * @param TokensList $list the list of tokens to be parsed * @param Token $token the token that is being parsed + * + * @return void */ public function before(Parser $parser, TokensList $list, Token $token) { diff --git a/src/Statements/ReplaceStatement.php b/src/Statements/ReplaceStatement.php index 29c581d80..43f8d9d2f 100644 --- a/src/Statements/ReplaceStatement.php +++ b/src/Statements/ReplaceStatement.php @@ -105,6 +105,8 @@ public function build() /** * @param Parser $parser the instance that requests parsing * @param TokensList $list the list of tokens to be parsed + * + * @return void */ public function parse(Parser $parser, TokensList $list) { diff --git a/src/Statements/TransactionStatement.php b/src/Statements/TransactionStatement.php index 84b350708..e1d653f39 100644 --- a/src/Statements/TransactionStatement.php +++ b/src/Statements/TransactionStatement.php @@ -69,6 +69,8 @@ class TransactionStatement extends Statement /** * @param Parser $parser the instance that requests parsing * @param TokensList $list the list of tokens to be parsed + * + * @return void */ public function parse(Parser $parser, TokensList $list) { diff --git a/src/Statements/WithStatement.php b/src/Statements/WithStatement.php index 92cfb79b0..193b9fbb8 100644 --- a/src/Statements/WithStatement.php +++ b/src/Statements/WithStatement.php @@ -63,6 +63,8 @@ final class WithStatement extends Statement /** * @param Parser $parser the instance that requests parsing * @param TokensList $list the list of tokens to be parsed + * + * @return void */ public function parse(Parser $parser, TokensList $list) { diff --git a/src/TokensList.php b/src/TokensList.php index 21cac879e..9f79b03f8 100644 --- a/src/TokensList.php +++ b/src/TokensList.php @@ -84,6 +84,8 @@ public static function build($list) * Adds a new token. * * @param Token $token token to be added in list + * + * @return void */ public function add(Token $token) { diff --git a/src/Tools/ContextGenerator.php b/src/Tools/ContextGenerator.php index e01105c1c..7728da615 100644 --- a/src/Tools/ContextGenerator.php +++ b/src/Tools/ContextGenerator.php @@ -320,6 +320,8 @@ public static function formatName($name) * * @param string $input the input file * @param string $output the output directory + * + * @return void */ public static function build($input, $output) { @@ -384,6 +386,8 @@ public static function build($input, $output) * * @param string $input the input directory * @param string $output the output directory + * + * @return void */ public static function buildAll($input, $output) { diff --git a/src/Tools/TestGenerator.php b/src/Tools/TestGenerator.php index bca85937c..9b57a3f61 100644 --- a/src/Tools/TestGenerator.php +++ b/src/Tools/TestGenerator.php @@ -129,6 +129,8 @@ public static function generate($query, $type = 'parser') * @param string $output the output file * @param string $debug the debug file * @param bool $ansi activate quotes ANSI mode + * + * @return void */ public static function build($type, $input, $output, $debug = null, $ansi = false) { @@ -188,6 +190,8 @@ public static function build($type, $input, $output, $debug = null, $ansi = fals * @param string $input the input directory * @param string $output the output directory * @param mixed|null $debug + * + * @return void */ public static function buildAll($input, $output, $debug = null) { diff --git a/src/Translator.php b/src/Translator.php index 82079d53a..549549f4e 100644 --- a/src/Translator.php +++ b/src/Translator.php @@ -29,6 +29,8 @@ class Translator /** * Loads translator. + * + * @return void */ public static function load() { diff --git a/src/Utils/BufferedQuery.php b/src/Utils/BufferedQuery.php index cdfeb45f3..e98d37aa5 100644 --- a/src/Utils/BufferedQuery.php +++ b/src/Utils/BufferedQuery.php @@ -125,6 +125,8 @@ public function __construct($query = '', array $options = []) * Used to update the length of it too. * * @param string $delimiter + * + * @return void */ public function setDelimiter($delimiter) { diff --git a/tests/TestCase.php b/tests/TestCase.php index 95890cf3f..4924ff181 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -100,7 +100,7 @@ public function getData($name) * * @param string $name the name of the test */ - public function runParserTest($name) + public function runParserTest($name): void { /** * Test's data. diff --git a/tests/Utils/BufferedQueryTest.php b/tests/Utils/BufferedQueryTest.php index 22321cf40..b6625363f 100644 --- a/tests/Utils/BufferedQueryTest.php +++ b/tests/Utils/BufferedQueryTest.php @@ -23,7 +23,7 @@ public function testExtract( $chunkSize, array $options, array $expected - ) { + ): void { $chunks = str_split($query, $chunkSize); $count = count($chunks);