Skip to content

Commit efcafa1

Browse files
Merge branch 'master' into More-refactoring-of-build-method
2 parents 08a480c + 26b7bee commit efcafa1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+976
-341
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,18 @@
66
- Move `Misc::getAliases()` into `SelectStatement::getAliases()` (#454)
77
- Drop `USE_UTF_STRINGS` constant (#471)
88

9-
## [5.x.x] - YYYY-MM-DD
9+
## [5.9.x] - YYYY-MM-DD
10+
11+
## [5.8.x] - YYYY-MM-DD
12+
13+
## [5.8.1] - 2023-09-15
1014

1115
- Fix `:=` was not recognized as an operator just like `=` (#306)
1216
- Fix `ALTER TABLE … MODIFY … ENUM('<reserved_keyword>')` is being wrongly parsed (#234)
1317
- Fix `ALTER TABLE … MODIFY … ENUM('<reserved_keyword>')` is being wrongly parsed (#478)
1418
- Fix MariaDB window function with alias gives bad linting errors (#283)
1519
- Fix unrecognized keyword `COLLATE` in `WHERE` clauses (#491)
20+
- Fix invalid hexadecimal prefix 0X (#508)
1621

1722
## [5.8.0] - 2023-06-05
1823

phpcs.xml.dist

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@
6666
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint">
6767
<severity>4</severity>
6868
</rule>
69-
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingNativeTypeHint">
70-
<severity>4</severity>
71-
</rule>
7269
<rule ref="Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps">
7370
<severity>4</severity>
7471
</rule>

phpstan-baseline.neon

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@ parameters:
55
count: 3
66
path: src/Components/AlterOperation.php
77

8-
-
9-
message: "#^Parameter \\#1 \\$key of function array_key_exists expects int\\|string, float\\|int\\|string given\\.$#"
10-
count: 2
11-
path: src/Components/AlterOperation.php
12-
138
-
149
message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\AlterOperation\\:\\:\\$options \\(PhpMyAdmin\\\\SqlParser\\\\Components\\\\OptionsArray\\) does not accept PhpMyAdmin\\\\SqlParser\\\\Components\\\\OptionsArray\\|null\\.$#"
1510
count: 1

psalm-baseline.xml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@
3838
'DO' => 10,
3939
]]]></code>
4040
</InvalidPropertyAssignmentValue>
41-
<MixedArrayOffset>
42-
<code><![CDATA[Parser::$statementParsers[$token->value]]]></code>
43-
</MixedArrayOffset>
4441
<PossiblyInvalidArgument>
4542
<code>$arrayKey</code>
4643
</PossiblyInvalidArgument>
@@ -773,9 +770,6 @@
773770
<code>$built[$field]</code>
774771
<code><![CDATA[$parsedClauses[$token->value]]]></code>
775772
</InvalidArgument>
776-
<MethodSignatureMustProvideReturnType>
777-
<code>__toString</code>
778-
</MethodSignatureMustProvideReturnType>
779773
<MixedArrayOffset>
780774
<code><![CDATA[$parsedClauses[$token->value]]]></code>
781775
<code><![CDATA[$parsedClauses[$token->value]]]></code>
@@ -1127,9 +1121,6 @@
11271121
</RedundantConditionGivenDocblockType>
11281122
</file>
11291123
<file src="src/UtfString.php">
1130-
<MethodSignatureMustProvideReturnType>
1131-
<code>__toString</code>
1132-
</MethodSignatureMustProvideReturnType>
11331124
<PossiblyUnusedProperty>
11341125
<code>$byteLen</code>
11351126
</PossiblyUnusedProperty>

src/Component.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@ interface Component extends Stringable
2222
* @param Parser $parser the parser that serves as context
2323
* @param TokensList $list the list of tokens that are being parsed
2424
* @param array<string, mixed> $options parameters for parsing
25-
*
26-
* @return mixed
2725
*/
28-
public static function parse(Parser $parser, TokensList $list, array $options = []);
26+
public static function parse(Parser $parser, TokensList $list, array $options = []): mixed;
2927

3028
/**
3129
* Builds the string representation of a component of this type.

src/Components/AlterOperation.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
use function array_key_exists;
1313
use function in_array;
14-
use function is_numeric;
14+
use function is_int;
1515
use function is_string;
1616
use function trim;
1717

@@ -300,10 +300,8 @@ public function __construct(
300300
* @param Parser $parser the parser that serves as context
301301
* @param TokensList $list the list of tokens that are being parsed
302302
* @param array<string, mixed> $options parameters for parsing
303-
*
304-
* @return AlterOperation
305303
*/
306-
public static function parse(Parser $parser, TokensList $list, array $options = [])
304+
public static function parse(Parser $parser, TokensList $list, array $options = []): AlterOperation
307305
{
308306
$ret = new static();
309307

@@ -410,7 +408,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
410408

411409
$state = 2;
412410
} elseif ($state === 2) {
413-
if (is_string($token->value) || is_numeric($token->value)) {
411+
if (is_string($token->value) || is_int($token->value)) {
414412
$arrayKey = $token->value;
415413
} else {
416414
$arrayKey = $token->token;
@@ -443,7 +441,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
443441
);
444442
break;
445443
}
446-
} elseif (! empty(Parser::$statementParsers[$token->value])) {
444+
} elseif (! empty(Parser::$statementParsers[$arrayKey])) {
447445
// We have reached the end of ALTER operation and suddenly found
448446
// a start to new statement, but have not found a delimiter between them
449447
$parser->error(

src/Components/ArrayObj.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function __construct(array $raw = [], array $values = [])
4949
*
5050
* @return ArrayObj|Component[]
5151
*/
52-
public static function parse(Parser $parser, TokensList $list, array $options = [])
52+
public static function parse(Parser $parser, TokensList $list, array $options = []): ArrayObj|array
5353
{
5454
$ret = empty($options['type']) ? new static() : [];
5555

@@ -89,6 +89,10 @@ public static function parse(Parser $parser, TokensList $list, array $options =
8989

9090
// End of statement.
9191
if ($token->type === Token::TYPE_DELIMITER) {
92+
if ($brackets > 0) {
93+
$parser->error('A closing bracket was expected.', $token);
94+
}
95+
9296
break;
9397
}
9498

src/Components/CaseExpression.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,8 @@ final class CaseExpression implements Component
7070
* @param Parser $parser the parser that serves as context
7171
* @param TokensList $list the list of tokens that are being parsed
7272
* @param array<string, mixed> $options parameters for parsing
73-
*
74-
* @return CaseExpression
7573
*/
76-
public static function parse(Parser $parser, TokensList $list, array $options = [])
74+
public static function parse(Parser $parser, TokensList $list, array $options = []): CaseExpression
7775
{
7876
$ret = new static();
7977

src/Components/CreateDefinition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ public function __construct(
180180
*
181181
* @return CreateDefinition[]
182182
*/
183-
public static function parse(Parser $parser, TokensList $list, array $options = [])
183+
public static function parse(Parser $parser, TokensList $list, array $options = []): array
184184
{
185185
$ret = [];
186186

src/Components/DataType.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,8 @@ public function __construct(
9393
* @param Parser $parser the parser that serves as context
9494
* @param TokensList $list the list of tokens that are being parsed
9595
* @param array<string, mixed> $options parameters for parsing
96-
*
97-
* @return DataType|null
9896
*/
99-
public static function parse(Parser $parser, TokensList $list, array $options = [])
97+
public static function parse(Parser $parser, TokensList $list, array $options = []): DataType|null
10098
{
10199
$ret = new static();
102100

0 commit comments

Comments
 (0)