Skip to content

Commit 286557a

Browse files
committed
We do not test invalid assumptions
Signed-off-by: Kamil Tekiela <[email protected]>
1 parent 6c671e7 commit 286557a

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
@@ -1050,11 +1050,6 @@ parameters:
10501050
count: 1
10511051
path: tests/Parser/SelectStatementTest.php
10521052

1053-
-
1054-
message: "#^Parameter \\#1 \\$component of static method PhpMyAdmin\\\\SqlParser\\\\Components\\\\WithKeyword\\:\\:build\\(\\) expects PhpMyAdmin\\\\SqlParser\\\\Components\\\\WithKeyword, stdClass given\\.$#"
1055-
count: 1
1056-
path: tests/Parser/WithStatementTest.php
1057-
10581053
-
10591054
message: "#^Parameter \\#2 \\$list of static method PhpMyAdmin\\\\SqlParser\\\\Utils\\\\Query\\:\\:getClause\\(\\) expects PhpMyAdmin\\\\SqlParser\\\\TokensList, PhpMyAdmin\\\\SqlParser\\\\TokensList\\|null given\\.$#"
10601055
count: 9

psalm-baseline.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1628,11 +1628,6 @@
16281628
<code>has</code>
16291629
</PossiblyNullReference>
16301630
</file>
1631-
<file src="tests/Parser/WithStatementTest.php">
1632-
<InvalidArgument>
1633-
<code>new stdClass()</code>
1634-
</InvalidArgument>
1635-
</file>
16361631
<file src="tests/TestCase.php">
16371632
<InvalidReturnStatement>
16381633
<code>$data</code>

src/Components/WithKeyword.php

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

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)