Skip to content

Commit 384b2f1

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

File tree

8 files changed

+10
-34
lines changed

8 files changed

+10
-34
lines changed

src/Statements/CallStatement.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,8 @@ class CallStatement extends Statement
2929

3030
/**
3131
* Build statement for CALL.
32-
*
33-
* @return string
3432
*/
35-
public function build()
33+
public function build(): string
3634
{
3735
return 'CALL ' . $this->call->name . '('
3836
. ($this->call->parameters ? implode(',', $this->call->parameters->raw) : '') . ')';

src/Statements/CreateStatement.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -408,10 +408,7 @@ class CreateStatement extends Statement
408408
*/
409409
public $body = [];
410410

411-
/**
412-
* @return string
413-
*/
414-
public function build()
411+
public function build(): string
415412
{
416413
$fields = '';
417414
if (! empty($this->fields)) {

src/Statements/RenameStatement.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,7 @@ public function before(Parser $parser, TokensList $list, Token $token)
4646
$list->getNextOfTypeAndValue(Token::TYPE_KEYWORD, 'TABLE');
4747
}
4848

49-
/**
50-
* @return string
51-
*/
52-
public function build()
49+
public function build(): string
5350
{
5451
return 'RENAME TABLE ' . RenameOperation::build($this->renames);
5552
}

src/Statements/TruncateStatement.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,8 @@ class TruncateStatement extends Statement
2929

3030
/**
3131
* Special build method for truncate statement as Statement::build would return empty string.
32-
*
33-
* @return string
3432
*/
35-
public function build()
33+
public function build(): string
3634
{
3735
return 'TRUNCATE TABLE ' . $this->table . ';';
3836
}

src/UtfString.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,10 +292,8 @@ public function offsetUnset($offset)
292292
* @see https://tools.ietf.org/html/rfc3629
293293
*
294294
* @param string $byte the byte to be analyzed
295-
*
296-
* @return int
297295
*/
298-
public static function getCharLength($byte)
296+
public static function getCharLength($byte): int
299297
{
300298
// Use the default ASCII map as queries are mostly ASCII chars
301299
// ord($byte) has a performance cost

src/Utils/CLI.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,7 @@ public function parseHighlight()
9797
return $params;
9898
}
9999

100-
/**
101-
* @return int
102-
*/
103-
public function runHighlight()
100+
public function runHighlight(): int
104101
{
105102
$params = $this->parseHighlight();
106103
if ($params === false) {
@@ -167,10 +164,7 @@ public function parseLint()
167164
return $params;
168165
}
169166

170-
/**
171-
* @return int
172-
*/
173-
public function runLint()
167+
public function runLint(): int
174168
{
175169
$params = $this->parseLint();
176170
if ($params === false) {
@@ -245,10 +239,7 @@ public function parseTokenize()
245239
return $params;
246240
}
247241

248-
/**
249-
* @return int
250-
*/
251-
public function runTokenize()
242+
public function runTokenize(): int
252243
{
253244
$params = $this->parseTokenize();
254245
if ($params === false) {

src/Utils/Formatter.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -766,10 +766,9 @@ public static function getGroupLength($list)
766766
*
767767
* @param Token $token the token to be checked
768768
*
769-
* @return int|false
770769
* @psalm-return 1|2|false
771770
*/
772-
public static function isClause($token)
771+
public static function isClause($token): int|false
773772
{
774773
if (
775774
($token->type === Token::TYPE_KEYWORD && isset(Parser::$statementParsers[$token->keyword]))

src/Utils/Query.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -738,10 +738,8 @@ public static function getClause($statement, $list, $clause, $type = 0, $skipFir
738738
* it is considered to be equal with `$old`.
739739
* @param bool $onlyType whether only the type of the clause should
740740
* be replaced or the entire clause
741-
*
742-
* @return string
743741
*/
744-
public static function replaceClause($statement, $list, $old, $new = null, $onlyType = false)
742+
public static function replaceClause($statement, $list, $old, $new = null, $onlyType = false): string
745743
{
746744
// TODO: Update the tokens list and the statement.
747745

0 commit comments

Comments
 (0)