Skip to content

Commit

Permalink
We do not test invalid assumptions
Browse files Browse the repository at this point in the history
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
  • Loading branch information
kamil-tekiela committed Jun 9, 2023
1 parent 599023f commit f69b6e6
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 21 deletions.
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -1055,11 +1055,6 @@ parameters:
count: 1
path: tests/Parser/SelectStatementTest.php

-
message: "#^Parameter \\#1 \\$component of static method PhpMyAdmin\\\\SqlParser\\\\Components\\\\WithKeyword\\:\\:build\\(\\) expects PhpMyAdmin\\\\SqlParser\\\\Components\\\\WithKeyword, stdClass given\\.$#"
count: 1
path: tests/Parser/WithStatementTest.php

-
message: "#^Parameter \\#2 \\$list of static method PhpMyAdmin\\\\SqlParser\\\\Utils\\\\Query\\:\\:getClause\\(\\) expects PhpMyAdmin\\\\SqlParser\\\\TokensList, PhpMyAdmin\\\\SqlParser\\\\TokensList\\|null given\\.$#"
count: 9
Expand Down
5 changes: 0 additions & 5 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1641,11 +1641,6 @@
<code>has</code>
</PossiblyNullReference>
</file>
<file src="tests/Parser/WithStatementTest.php">
<InvalidArgument>
<code>new stdClass()</code>
</InvalidArgument>
</file>
<file src="tests/TestCase.php">
<InvalidReturnStatement>
<code>$data</code>
Expand Down
4 changes: 0 additions & 4 deletions src/Components/WithKeyword.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ public static function parse(Parser $parser, TokensList $list, array $options =
*/
public static function build($component, array $options = []): string
{
if (! $component instanceof WithKeyword) {
throw new RuntimeException('Can not build a component that is not a WithKeyword');
}

if (! isset($component->statement)) {
throw new RuntimeException('No statement inside WITH');
}
Expand Down
7 changes: 0 additions & 7 deletions tests/Parser/WithStatementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use PhpMyAdmin\SqlParser\Lexer;
use PhpMyAdmin\SqlParser\Parser;
use PhpMyAdmin\SqlParser\Tests\TestCase;
use stdClass;

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

public function testBuildWrongWithKeyword(): void
{
$this->expectExceptionMessage('Can not build a component that is not a WithKeyword');
WithKeyword::build(new stdClass());
}

public function testBuildBadWithKeyword(): void
{
$this->expectExceptionMessage('No statement inside WITH');
Expand Down

0 comments on commit f69b6e6

Please sign in to comment.