Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 52c51e3

Browse files
Merge pull request #616 from kamil-tekiela/indexHints
Remove nullability from IndexHint
2 parents 25ad961 + aec2309 commit 52c51e3

File tree

5 files changed

+10
-42
lines changed

5 files changed

+10
-42
lines changed

‎phpstan-baseline.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ parameters:
745745
path: src/Parsers/GroupKeywords.php
746746

747747
-
748-
message: '#^Property PhpMyAdmin\\SqlParser\\Components\\IndexHint\:\:\$type \(string\|null\) does not accept mixed\.$#'
748+
message: '#^Property PhpMyAdmin\\SqlParser\\Components\\IndexHint\:\:\$type \(string\) does not accept mixed\.$#'
749749
identifier: assign.propertyType
750750
count: 1
751751
path: src/Parsers/IndexHints.php

‎psalm-baseline.xml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="6.0.0@b8e96bb617bf59382113b1b56cef751f648a7dc9">
2+
<files psalm-version="6.1.0@827971f8bc7a28bb4f842f34bf8901521de1cea3">
33
<file src="src/Components/AlterOperation.php">
44
<PossiblyNullReference>
55
<code><![CDATA[has]]></code>
@@ -45,12 +45,6 @@
4545
<code><![CDATA[$type]]></code>
4646
</PossiblyUnusedProperty>
4747
</file>
48-
<file src="src/Components/IndexHint.php">
49-
<PossiblyNullOperand>
50-
<code><![CDATA[$this->indexOrKey]]></code>
51-
<code><![CDATA[$this->type]]></code>
52-
</PossiblyNullOperand>
53-
</file>
5448
<file src="src/Components/IntoKeyword.php">
5549
<PossiblyNullOperand>
5650
<code><![CDATA[$this->dest]]></code>

‎src/Components/IndexHint.php

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,43 +13,17 @@
1313
final class IndexHint implements Component
1414
{
1515
/**
16-
* The type of hint (USE/FORCE/IGNORE)
17-
*/
18-
public string|null $type;
19-
20-
/**
21-
* What the hint is for (INDEX/KEY)
22-
*/
23-
public string|null $indexOrKey;
24-
25-
/**
26-
* The clause for which this hint is (JOIN/ORDER BY/GROUP BY)
27-
*/
28-
public string|null $for;
29-
30-
/**
31-
* List of indexes in this hint
32-
*
33-
* @var Expression[]
34-
*/
35-
public array $indexes = [];
36-
37-
/**
38-
* @param string $type the type of hint (USE/FORCE/IGNORE)
16+
* @param string $type The type of hint (USE/FORCE/IGNORE)
3917
* @param string $indexOrKey What the hint is for (INDEX/KEY)
40-
* @param string$for the clause for which this hint is (JOIN/ORDER BY/GROUP BY)
18+
* @param string|null $for The clause for which this hint is (JOIN/ORDER BY/GROUP BY)
4119
* @param Expression[] $indexes List of indexes in this hint
4220
*/
4321
public function __construct(
44-
string|null $type = null,
45-
string|null $indexOrKey = null,
46-
string|null $for = null,
47-
array $indexes = [],
22+
publicstring $type = '',
23+
publicstring $indexOrKey = '',
24+
publicstring|null $for = null,
25+
publicarray $indexes = [],
4826
) {
49-
$this->type = $type;
50-
$this->indexOrKey = $indexOrKey;
51-
$this->for = $for;
52-
$this->indexes = $indexes;
5327
}
5428

5529
public function build(): string

‎src/Parsers/IndexHints.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
2828
{
2929
$ret = [];
3030
$expr = new IndexHint();
31-
$expr->type = $options['type'] ?? null;
31+
$expr->type = $options['type'] ?? '';
3232
/**
3333
* The state of the parser.
3434
*

‎tests/data/parser/parseSelectIndexHintErr1.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@
252252
{
253253
"@type": "PhpMyAdmin\\SqlParser\\Components\\IndexHint",
254254
"type": "FORCE",
255-
"indexOrKey": null,
255+
"indexOrKey": "",
256256
"for": null,
257257
"indexes": [
258258
{

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /