Skip to content

Commit f69b6e6

Browse files
committed
We do not test invalid assumptions
Signed-off-by: Kamil Tekiela <[email protected]>
1 parent 599023f commit f69b6e6

File tree

4 files changed

+0
-21
lines changed

4 files changed

+0
-21
lines changed

phpstan-baseline.neon

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,11 +1055,6 @@ parameters:
10551055
count: 1
10561056
path: tests/Parser/SelectStatementTest.php
10571057

1058-
-
1059-
message: "#^Parameter \\#1 \\$component of static method PhpMyAdmin\\\\SqlParser\\\\Components\\\\WithKeyword\\:\\:build\\(\\) expects PhpMyAdmin\\\\SqlParser\\\\Components\\\\WithKeyword, stdClass given\\.$#"
1060-
count: 1
1061-
path: tests/Parser/WithStatementTest.php
1062-
10631058
-
10641059
message: "#^Parameter \\#2 \\$list of static method PhpMyAdmin\\\\SqlParser\\\\Utils\\\\Query\\:\\:getClause\\(\\) expects PhpMyAdmin\\\\SqlParser\\\\TokensList, PhpMyAdmin\\\\SqlParser\\\\TokensList\\|null given\\.$#"
10651060
count: 9

psalm-baseline.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1641,11 +1641,6 @@
16411641
<code>has</code>
16421642
</PossiblyNullReference>
16431643
</file>
1644-
<file src="tests/Parser/WithStatementTest.php">
1645-
<InvalidArgument>
1646-
<code>new stdClass()</code>
1647-
</InvalidArgument>
1648-
</file>
16491644
<file src="tests/TestCase.php">
16501645
<InvalidReturnStatement>
16511646
<code>$data</code>

src/Components/WithKeyword.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ public static function parse(Parser $parser, TokensList $list, array $options =
5151
*/
5252
public static function build($component, array $options = []): string
5353
{
54-
if (! $component instanceof WithKeyword) {
55-
throw new RuntimeException('Can not build a component that is not a WithKeyword');
56-
}
57-
5854
if (! isset($component->statement)) {
5955
throw new RuntimeException('No statement inside WITH');
6056
}

tests/Parser/WithStatementTest.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use PhpMyAdmin\SqlParser\Lexer;
99
use PhpMyAdmin\SqlParser\Parser;
1010
use PhpMyAdmin\SqlParser\Tests\TestCase;
11-
use stdClass;
1211

1312
class WithStatementTest extends TestCase
1413
{
@@ -134,12 +133,6 @@ public function testWithHasUnclosedParenthesis(): void
134133
$this->assertEquals($parserErrors[0][0], 'A closing bracket was expected.');
135134
}
136135

137-
public function testBuildWrongWithKeyword(): void
138-
{
139-
$this->expectExceptionMessage('Can not build a component that is not a WithKeyword');
140-
WithKeyword::build(new stdClass());
141-
}
142-
143136
public function testBuildBadWithKeyword(): void
144137
{
145138
$this->expectExceptionMessage('No statement inside WITH');

0 commit comments

Comments
 (0)