Skip to content

Commit ad6fe11

Browse files
committed
Add native void type
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
1 parent 8f524d7 commit ad6fe11

26 files changed

Lines changed: 37 additions & 96 deletions

src/Components/IntoKeyword.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,8 @@ public static function parse(Parser $parser, TokensList $list, array $options =
242242
* @param Parser $parser The parser
243243
* @param TokensList $list A token list
244244
* @param string $keyword The keyword
245-
*
246-
* @return void
247245
*/
248-
public function parseFileOptions(Parser $parser, TokensList $list, $keyword = 'FIELDS')
246+
public function parseFileOptions(Parser $parser, TokensList $list, $keyword = 'FIELDS'): void
249247
{
250248
++$list->idx;
251249

src/Components/OptionsArray.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,10 +353,8 @@ public function remove($key): bool
353353
* replaced.
354354
*
355355
* @param array<int, mixed>|OptionsArray $options the options to be merged
356-
*
357-
* @return void
358356
*/
359-
public function merge($options)
357+
public function merge($options): void
360358
{
361359
if (is_array($options)) {
362360
$this->options = array_merge_recursive($this->options, $options);

src/Context.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -605,10 +605,8 @@ public static function getMode(): int
605605
* Sets the SQL mode.
606606
*
607607
* @param int|string $mode
608-
*
609-
* @return void
610608
*/
611-
public static function setMode($mode = self::SQL_MODE_NONE)
609+
public static function setMode($mode = self::SQL_MODE_NONE): void
612610
{
613611
if (is_int($mode)) {
614612
static::$mode = $mode;

src/Lexer.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -220,21 +220,17 @@ public function __construct($str, $strict = false, $delimiter = null)
220220
* Sets the delimiter.
221221
*
222222
* @param string $delimiter the new delimiter
223-
*
224-
* @return void
225223
*/
226-
public function setDelimiter($delimiter)
224+
public function setDelimiter($delimiter): void
227225
{
228226
$this->delimiter = $delimiter;
229227
$this->delimiterLen = strlen($delimiter);
230228
}
231229

232230
/**
233231
* Parses the string and extracts lexemes.
234-
*
235-
* @return void
236232
*/
237-
public function lex()
233+
public function lex(): void
238234
{
239235
// TODO: Sometimes, static::parse* functions make unnecessary calls to
240236
// is* functions. For a better performance, some rules can be deduced
@@ -463,11 +459,9 @@ private function solveAmbiguityOnFunctionKeywords(): void
463459
* @param int $pos the position of the character
464460
* @param int $code the code of the error
465461
*
466-
* @return void
467-
*
468462
* @throws LexerException throws the exception, if strict mode is enabled.
469463
*/
470-
public function error($msg, $str = '', $pos = 0, $code = 0)
464+
public function error($msg, $str = '', $pos = 0, $code = 0): void
471465
{
472466
$error = new LexerException(
473467
Translator::gettext($msg),

src/Parser.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -391,11 +391,9 @@ public function __construct($list = null, $strict = false)
391391
/**
392392
* Builds the parse trees.
393393
*
394-
* @return void
395-
*
396394
* @throws ParserException
397395
*/
398-
public function parse()
396+
public function parse(): void
399397
{
400398
/**
401399
* Last transaction.
@@ -625,11 +623,9 @@ public function parse()
625623
* @param Token $token the token that produced the error
626624
* @param int $code the code of the error
627625
*
628-
* @return void
629-
*
630626
* @throws ParserException throws the exception, if strict mode is enabled.
631627
*/
632-
public function error($msg, Token|null $token = null, $code = 0)
628+
public function error($msg, Token|null $token = null, $code = 0): void
633629
{
634630
$error = new ParserException(
635631
Translator::gettext($msg),

src/Statement.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,9 @@ public function build()
210210
* @param Parser $parser the instance that requests parsing
211211
* @param TokensList $list the list of tokens to be parsed
212212
*
213-
* @return void
214-
*
215213
* @throws Exceptions\ParserException
216214
*/
217-
public function parse(Parser $parser, TokensList $list)
215+
public function parse(Parser $parser, TokensList $list): void
218216
{
219217
/**
220218
* Array containing all list of clauses parsed.
@@ -423,10 +421,8 @@ public function parse(Parser $parser, TokensList $list)
423421
* @param Parser $parser the instance that requests parsing
424422
* @param TokensList $list the list of tokens to be parsed
425423
* @param Token $token the token that is being parsed
426-
*
427-
* @return void
428424
*/
429-
public function before(Parser $parser, TokensList $list, Token $token)
425+
public function before(Parser $parser, TokensList $list, Token $token): void
430426
{
431427
}
432428

@@ -436,10 +432,8 @@ public function before(Parser $parser, TokensList $list, Token $token)
436432
* @param Parser $parser the instance that requests parsing
437433
* @param TokensList $list the list of tokens to be parsed
438434
* @param Token $token the token that is being parsed
439-
*
440-
* @return void
441435
*/
442-
public function after(Parser $parser, TokensList $list, Token $token)
436+
public function after(Parser $parser, TokensList $list, Token $token): void
443437
{
444438
}
445439

src/Statements/AlterStatement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class AlterStatement extends Statement
6464
* @param Parser $parser the instance that requests parsing
6565
* @param TokensList $list the list of tokens to be parsed
6666
*/
67-
public function parse(Parser $parser, TokensList $list)
67+
public function parse(Parser $parser, TokensList $list): void
6868
{
6969
++$list->idx; // Skipping `ALTER`.
7070
$this->options = OptionsArray::parse($parser, $list, static::$statementOptions);

src/Statements/CreateStatement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ public function build()
524524
* @param Parser $parser the instance that requests parsing
525525
* @param TokensList $list the list of tokens to be parsed
526526
*/
527-
public function parse(Parser $parser, TokensList $list)
527+
public function parse(Parser $parser, TokensList $list): void
528528
{
529529
++$list->idx; // Skipping `CREATE`.
530530

src/Statements/DeleteStatement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public function build()
200200
* @param Parser $parser the instance that requests parsing
201201
* @param TokensList $list the list of tokens to be parsed
202202
*/
203-
public function parse(Parser $parser, TokensList $list)
203+
public function parse(Parser $parser, TokensList $list): void
204204
{
205205
++$list->idx; // Skipping `DELETE`.
206206

src/Statements/ExplainStatement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class ExplainStatement extends Statement
8484
* @param Parser $parser the instance that requests parsing
8585
* @param TokensList $list the list of tokens to be parsed
8686
*/
87-
public function parse(Parser $parser, TokensList $list)
87+
public function parse(Parser $parser, TokensList $list): void
8888
{
8989
/**
9090
* The state of the parser.

0 commit comments

Comments
 (0)