From b299035f9f12f865ce9400350c8b07e7a902a6c4 Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Tue, 29 Aug 2023 23:18:27 +0100 Subject: [PATCH] Escape identifiers that need it Signed-off-by: Kamil Tekiela --- phpstan-baseline.neon | 10 ---------- psalm-baseline.xml | 2 +- src/Context.php | 12 +++++++++++- tests/Lexer/ContextTest.php | 4 ++++ 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index a5f50405d..fcc9a6308 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -925,16 +925,6 @@ parameters: count: 2 path: tests/Components/PartitionDefinitionTest.php - - - message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertArrayHasKey\\(\\) with 2 and PhpMyAdmin\\\\SqlParser\\\\TokensList will always evaluate to false\\.$#" - count: 1 - path: tests/Lexer/TokensListTest.php - - - - message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertArrayHasKey\\(\\) with 112 and PhpMyAdmin\\\\SqlParser\\\\UtfString will always evaluate to false\\.$#" - count: 1 - path: tests/Misc/UtfStringTest.php - - message: "#^Cannot call method has\\(\\) on PhpMyAdmin\\\\SqlParser\\\\Components\\\\OptionsArray\\|null\\.$#" count: 1 diff --git a/psalm-baseline.xml b/psalm-baseline.xml index cf3c3d26f..e442ecfe0 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + assertEquals('test', Context::escape('test')); + $this->assertEquals('`123`', Context::escape('123')); + $this->assertEquals('`$test`', Context::escape('$test')); + $this->assertEquals('`te st`', Context::escape('te st')); + $this->assertEquals('`te.st`', Context::escape('te.st')); Context::setMode(Context::SQL_MODE_ANSI_QUOTES); $this->assertEquals('"test"', Context::escape('test'));