From d448d1fa8886fa73e41b0204a5cc46b505b1bfb6 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Mon, 23 May 2022 15:12:27 +0200 Subject: [PATCH] trim queries for cross-OS compat (#376) * trim queries for cross-OS compat * re-record Co-authored-by: Markus Staab --- .phpstan-dba-mysqli.cache | 249 +++++++++--------- .phpstan-dba-pdo.cache | 249 +++++++++--------- src/QueryReflection/QueryReflection.php | 2 +- src/QueryReflection/ReflectionCache.php | 2 +- .../default/config/.phpstan-dba-mysqli.cache | 5 +- tests/default/config/.phpstan-dba-pdo.cache | 5 +- .../config/.phpunit-phpstan-dba-mysqli.cache | 5 +- .../config/.phpunit-phpstan-dba-pdo.cache | 5 +- .../config/.phpstan-dba-mysqli.cache | 2 +- .../config/.phpstan-dba-pdo.cache | 2 +- .../config/.phpunit-phpstan-dba-mysqli.cache | 2 +- .../config/.phpunit-phpstan-dba-pdo.cache | 2 +- .../config/.phpstan-dba-mysqli.cache | 2 +- .../config/.phpstan-dba-pdo.cache | 2 +- .../config/.phpunit-phpstan-dba-mysqli.cache | 2 +- .../config/.phpunit-phpstan-dba-pdo.cache | 2 +- tests/rules/config/.phpstan-dba-mysqli.cache | 20 +- tests/rules/config/.phpstan-dba-pdo.cache | 20 +- .../config/.phpunit-phpstan-dba-mysqli.cache | 238 +++++++---------- .../config/.phpunit-phpstan-dba-pdo.cache | 238 +++++++---------- .../config/.phpstan-dba-mysqli.cache | 2 +- tests/stringify/config/.phpstan-dba-pdo.cache | 2 +- .../config/.phpunit-phpstan-dba-mysqli.cache | 2 +- .../config/.phpunit-phpstan-dba-pdo.cache | 2 +- 24 files changed, 488 insertions(+), 574 deletions(-) diff --git a/.phpstan-dba-mysqli.cache b/.phpstan-dba-mysqli.cache index f75763109..c406e68b2 100644 --- a/.phpstan-dba-mysqli.cache +++ b/.phpstan-dba-mysqli.cache @@ -1,10 +1,131 @@ 'v7-normalized-eol-prepared', + 'schemaVersion' => 'v7-trim-queries', 'schemaHash' => NULL, 'records' => array ( - ' - SELECT + 'SELECT + coalesce(COLUMN_NAME, "") as COLUMN_NAME, + coalesce(EXTRA, "") as EXTRA, + COLUMN_TYPE + FROM information_schema.columns + WHERE table_name = \'1970-01-01\' AND table_schema = DATABASE()' => + array ( + 'result' => + array ( + 5 => + PHPStan\Type\Constant\ConstantArrayType::__set_state(array( + 'allArrays' => NULL, + 'nextAutoIndexes' => + array ( + 0 => 3, + ), + 'keyTypes' => + array ( + 0 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'value' => 'COLUMN_NAME', + 'isClassString' => false, + )), + 1 => + PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( + 'value' => 0, + )), + 2 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'value' => 'EXTRA', + 'isClassString' => false, + )), + 3 => + PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( + 'value' => 1, + )), + 4 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'value' => 'COLUMN_TYPE', + 'isClassString' => false, + )), + 5 => + PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( + 'value' => 2, + )), + ), + 'valueTypes' => + array ( + 0 => + PHPStan\Type\StringType::__set_state(array( + )), + 1 => + PHPStan\Type\StringType::__set_state(array( + )), + 2 => + PHPStan\Type\StringType::__set_state(array( + )), + 3 => + PHPStan\Type\StringType::__set_state(array( + )), + 4 => + PHPStan\Type\StringType::__set_state(array( + )), + 5 => + PHPStan\Type\StringType::__set_state(array( + )), + ), + 'optionalKeys' => + array ( + ), + 'keyType' => + PHPStan\Type\UnionType::__set_state(array( + 'sortedTypes' => true, + 'types' => + array ( + 0 => + PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( + 'value' => 0, + )), + 1 => + PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( + 'value' => 1, + )), + 2 => + PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( + 'value' => 2, + )), + 3 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'value' => 'COLUMN_NAME', + 'isClassString' => false, + )), + 4 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'value' => 'COLUMN_TYPE', + 'isClassString' => false, + )), + 5 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'value' => 'EXTRA', + 'isClassString' => false, + )), + ), + )), + 'itemType' => + PHPStan\Type\StringType::__set_state(array( + )), + )), + ), + ), + 'SELECT + coalesce(COLUMN_NAME, "") as COLUMN_NAME, + coalesce(EXTRA, "") as EXTRA, + COLUMN_TYPE + FROM information_schema.columns + WHERE table_name = ? AND table_schema = DATABASE()' => + array ( + 'result' => + array ( + 5 => NULL, + ), + ), + 'SELECT MD5( GROUP_CONCAT( CONCAT( @@ -211,128 +332,6 @@ )), ), ), - 'SELECT - coalesce(COLUMN_NAME, "") as COLUMN_NAME, - coalesce(EXTRA, "") as EXTRA, - COLUMN_TYPE - FROM information_schema.columns - WHERE table_name = \'1970-01-01\' AND table_schema = DATABASE()' => - array ( - 'result' => - array ( - 5 => - PHPStan\Type\Constant\ConstantArrayType::__set_state(array( - 'allArrays' => NULL, - 'nextAutoIndexes' => - array ( - 0 => 3, - ), - 'keyTypes' => - array ( - 0 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'value' => 'COLUMN_NAME', - 'isClassString' => false, - )), - 1 => - PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( - 'value' => 0, - )), - 2 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'value' => 'EXTRA', - 'isClassString' => false, - )), - 3 => - PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( - 'value' => 1, - )), - 4 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'value' => 'COLUMN_TYPE', - 'isClassString' => false, - )), - 5 => - PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( - 'value' => 2, - )), - ), - 'valueTypes' => - array ( - 0 => - PHPStan\Type\StringType::__set_state(array( - )), - 1 => - PHPStan\Type\StringType::__set_state(array( - )), - 2 => - PHPStan\Type\StringType::__set_state(array( - )), - 3 => - PHPStan\Type\StringType::__set_state(array( - )), - 4 => - PHPStan\Type\StringType::__set_state(array( - )), - 5 => - PHPStan\Type\StringType::__set_state(array( - )), - ), - 'optionalKeys' => - array ( - ), - 'keyType' => - PHPStan\Type\UnionType::__set_state(array( - 'sortedTypes' => true, - 'types' => - array ( - 0 => - PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( - 'value' => 0, - )), - 1 => - PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( - 'value' => 1, - )), - 2 => - PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( - 'value' => 2, - )), - 3 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'value' => 'COLUMN_NAME', - 'isClassString' => false, - )), - 4 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'value' => 'COLUMN_TYPE', - 'isClassString' => false, - )), - 5 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'value' => 'EXTRA', - 'isClassString' => false, - )), - ), - )), - 'itemType' => - PHPStan\Type\StringType::__set_state(array( - )), - )), - ), - ), - 'SELECT - coalesce(COLUMN_NAME, "") as COLUMN_NAME, - coalesce(EXTRA, "") as EXTRA, - COLUMN_TYPE - FROM information_schema.columns - WHERE table_name = ? AND table_schema = DATABASE()' => - array ( - 'result' => - array ( - 5 => NULL, - ), - ), 'SELECT column_name, column_default, is_nullable FROM information_schema.columns WHERE table_name = \'1970-01-01\'' => diff --git a/.phpstan-dba-pdo.cache b/.phpstan-dba-pdo.cache index f75763109..c406e68b2 100644 --- a/.phpstan-dba-pdo.cache +++ b/.phpstan-dba-pdo.cache @@ -1,10 +1,131 @@ 'v7-normalized-eol-prepared', + 'schemaVersion' => 'v7-trim-queries', 'schemaHash' => NULL, 'records' => array ( - ' - SELECT + 'SELECT + coalesce(COLUMN_NAME, "") as COLUMN_NAME, + coalesce(EXTRA, "") as EXTRA, + COLUMN_TYPE + FROM information_schema.columns + WHERE table_name = \'1970-01-01\' AND table_schema = DATABASE()' => + array ( + 'result' => + array ( + 5 => + PHPStan\Type\Constant\ConstantArrayType::__set_state(array( + 'allArrays' => NULL, + 'nextAutoIndexes' => + array ( + 0 => 3, + ), + 'keyTypes' => + array ( + 0 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'value' => 'COLUMN_NAME', + 'isClassString' => false, + )), + 1 => + PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( + 'value' => 0, + )), + 2 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'value' => 'EXTRA', + 'isClassString' => false, + )), + 3 => + PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( + 'value' => 1, + )), + 4 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'value' => 'COLUMN_TYPE', + 'isClassString' => false, + )), + 5 => + PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( + 'value' => 2, + )), + ), + 'valueTypes' => + array ( + 0 => + PHPStan\Type\StringType::__set_state(array( + )), + 1 => + PHPStan\Type\StringType::__set_state(array( + )), + 2 => + PHPStan\Type\StringType::__set_state(array( + )), + 3 => + PHPStan\Type\StringType::__set_state(array( + )), + 4 => + PHPStan\Type\StringType::__set_state(array( + )), + 5 => + PHPStan\Type\StringType::__set_state(array( + )), + ), + 'optionalKeys' => + array ( + ), + 'keyType' => + PHPStan\Type\UnionType::__set_state(array( + 'sortedTypes' => true, + 'types' => + array ( + 0 => + PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( + 'value' => 0, + )), + 1 => + PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( + 'value' => 1, + )), + 2 => + PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( + 'value' => 2, + )), + 3 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'value' => 'COLUMN_NAME', + 'isClassString' => false, + )), + 4 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'value' => 'COLUMN_TYPE', + 'isClassString' => false, + )), + 5 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'value' => 'EXTRA', + 'isClassString' => false, + )), + ), + )), + 'itemType' => + PHPStan\Type\StringType::__set_state(array( + )), + )), + ), + ), + 'SELECT + coalesce(COLUMN_NAME, "") as COLUMN_NAME, + coalesce(EXTRA, "") as EXTRA, + COLUMN_TYPE + FROM information_schema.columns + WHERE table_name = ? AND table_schema = DATABASE()' => + array ( + 'result' => + array ( + 5 => NULL, + ), + ), + 'SELECT MD5( GROUP_CONCAT( CONCAT( @@ -211,128 +332,6 @@ )), ), ), - 'SELECT - coalesce(COLUMN_NAME, "") as COLUMN_NAME, - coalesce(EXTRA, "") as EXTRA, - COLUMN_TYPE - FROM information_schema.columns - WHERE table_name = \'1970-01-01\' AND table_schema = DATABASE()' => - array ( - 'result' => - array ( - 5 => - PHPStan\Type\Constant\ConstantArrayType::__set_state(array( - 'allArrays' => NULL, - 'nextAutoIndexes' => - array ( - 0 => 3, - ), - 'keyTypes' => - array ( - 0 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'value' => 'COLUMN_NAME', - 'isClassString' => false, - )), - 1 => - PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( - 'value' => 0, - )), - 2 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'value' => 'EXTRA', - 'isClassString' => false, - )), - 3 => - PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( - 'value' => 1, - )), - 4 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'value' => 'COLUMN_TYPE', - 'isClassString' => false, - )), - 5 => - PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( - 'value' => 2, - )), - ), - 'valueTypes' => - array ( - 0 => - PHPStan\Type\StringType::__set_state(array( - )), - 1 => - PHPStan\Type\StringType::__set_state(array( - )), - 2 => - PHPStan\Type\StringType::__set_state(array( - )), - 3 => - PHPStan\Type\StringType::__set_state(array( - )), - 4 => - PHPStan\Type\StringType::__set_state(array( - )), - 5 => - PHPStan\Type\StringType::__set_state(array( - )), - ), - 'optionalKeys' => - array ( - ), - 'keyType' => - PHPStan\Type\UnionType::__set_state(array( - 'sortedTypes' => true, - 'types' => - array ( - 0 => - PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( - 'value' => 0, - )), - 1 => - PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( - 'value' => 1, - )), - 2 => - PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( - 'value' => 2, - )), - 3 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'value' => 'COLUMN_NAME', - 'isClassString' => false, - )), - 4 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'value' => 'COLUMN_TYPE', - 'isClassString' => false, - )), - 5 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'value' => 'EXTRA', - 'isClassString' => false, - )), - ), - )), - 'itemType' => - PHPStan\Type\StringType::__set_state(array( - )), - )), - ), - ), - 'SELECT - coalesce(COLUMN_NAME, "") as COLUMN_NAME, - coalesce(EXTRA, "") as EXTRA, - COLUMN_TYPE - FROM information_schema.columns - WHERE table_name = ? AND table_schema = DATABASE()' => - array ( - 'result' => - array ( - 5 => NULL, - ), - ), 'SELECT column_name, column_default, is_nullable FROM information_schema.columns WHERE table_name = \'1970-01-01\'' => diff --git a/src/QueryReflection/QueryReflection.php b/src/QueryReflection/QueryReflection.php index eb6fbe280..446fec1e8 100644 --- a/src/QueryReflection/QueryReflection.php +++ b/src/QueryReflection/QueryReflection.php @@ -147,7 +147,7 @@ public function resolveQueryStrings(Expr $queryExpr, Scope $scope): iterable */ private function normalizeQueryString(string $queryString): string { - return str_replace("\r\n", "\n", $queryString); + return str_replace("\r\n", "\n", trim($queryString)); } /** diff --git a/src/QueryReflection/ReflectionCache.php b/src/QueryReflection/ReflectionCache.php index c7aca16cd..81cd23aff 100644 --- a/src/QueryReflection/ReflectionCache.php +++ b/src/QueryReflection/ReflectionCache.php @@ -13,7 +13,7 @@ final class ReflectionCache { - public const SCHEMA_VERSION = 'v7-normalized-eol-prepared'; + public const SCHEMA_VERSION = 'v7-trim-queries'; /** * @var string diff --git a/tests/default/config/.phpstan-dba-mysqli.cache b/tests/default/config/.phpstan-dba-mysqli.cache index 80eb5982f..df4e6fdf8 100644 --- a/tests/default/config/.phpstan-dba-mysqli.cache +++ b/tests/default/config/.phpstan-dba-mysqli.cache @@ -1,10 +1,9 @@ 'v7-normalized-eol-prepared', + 'schemaVersion' => 'v7-trim-queries', 'schemaHash' => NULL, 'records' => array ( - ' - SELECT + 'SELECT adaid FROM ada' => diff --git a/tests/default/config/.phpstan-dba-pdo.cache b/tests/default/config/.phpstan-dba-pdo.cache index 80eb5982f..df4e6fdf8 100644 --- a/tests/default/config/.phpstan-dba-pdo.cache +++ b/tests/default/config/.phpstan-dba-pdo.cache @@ -1,10 +1,9 @@ 'v7-normalized-eol-prepared', + 'schemaVersion' => 'v7-trim-queries', 'schemaHash' => NULL, 'records' => array ( - ' - SELECT + 'SELECT adaid FROM ada' => diff --git a/tests/default/config/.phpunit-phpstan-dba-mysqli.cache b/tests/default/config/.phpunit-phpstan-dba-mysqli.cache index 339ddfe83..64434076e 100644 --- a/tests/default/config/.phpunit-phpstan-dba-mysqli.cache +++ b/tests/default/config/.phpunit-phpstan-dba-mysqli.cache @@ -1,10 +1,9 @@ 'v7-normalized-eol-prepared', + 'schemaVersion' => 'v7-trim-queries', 'schemaHash' => NULL, 'records' => array ( - ' - SELECT + 'SELECT adaid FROM ada' => diff --git a/tests/default/config/.phpunit-phpstan-dba-pdo.cache b/tests/default/config/.phpunit-phpstan-dba-pdo.cache index 76a69bc78..01f1830a9 100644 --- a/tests/default/config/.phpunit-phpstan-dba-pdo.cache +++ b/tests/default/config/.phpunit-phpstan-dba-pdo.cache @@ -1,10 +1,9 @@ 'v7-normalized-eol-prepared', + 'schemaVersion' => 'v7-trim-queries', 'schemaHash' => NULL, 'records' => array ( - ' - SELECT + 'SELECT adaid FROM ada' => diff --git a/tests/defaultFetchAssoc/config/.phpstan-dba-mysqli.cache b/tests/defaultFetchAssoc/config/.phpstan-dba-mysqli.cache index b817e13f5..396b95b69 100644 --- a/tests/defaultFetchAssoc/config/.phpstan-dba-mysqli.cache +++ b/tests/defaultFetchAssoc/config/.phpstan-dba-mysqli.cache @@ -1,5 +1,5 @@ 'v7-normalized-eol-prepared', + 'schemaVersion' => 'v7-trim-queries', 'schemaHash' => NULL, 'records' => array ( diff --git a/tests/defaultFetchAssoc/config/.phpstan-dba-pdo.cache b/tests/defaultFetchAssoc/config/.phpstan-dba-pdo.cache index b817e13f5..396b95b69 100644 --- a/tests/defaultFetchAssoc/config/.phpstan-dba-pdo.cache +++ b/tests/defaultFetchAssoc/config/.phpstan-dba-pdo.cache @@ -1,5 +1,5 @@ 'v7-normalized-eol-prepared', + 'schemaVersion' => 'v7-trim-queries', 'schemaHash' => NULL, 'records' => array ( diff --git a/tests/defaultFetchAssoc/config/.phpunit-phpstan-dba-mysqli.cache b/tests/defaultFetchAssoc/config/.phpunit-phpstan-dba-mysqli.cache index b817e13f5..396b95b69 100644 --- a/tests/defaultFetchAssoc/config/.phpunit-phpstan-dba-mysqli.cache +++ b/tests/defaultFetchAssoc/config/.phpunit-phpstan-dba-mysqli.cache @@ -1,5 +1,5 @@ 'v7-normalized-eol-prepared', + 'schemaVersion' => 'v7-trim-queries', 'schemaHash' => NULL, 'records' => array ( diff --git a/tests/defaultFetchAssoc/config/.phpunit-phpstan-dba-pdo.cache b/tests/defaultFetchAssoc/config/.phpunit-phpstan-dba-pdo.cache index b817e13f5..396b95b69 100644 --- a/tests/defaultFetchAssoc/config/.phpunit-phpstan-dba-pdo.cache +++ b/tests/defaultFetchAssoc/config/.phpunit-phpstan-dba-pdo.cache @@ -1,5 +1,5 @@ 'v7-normalized-eol-prepared', + 'schemaVersion' => 'v7-trim-queries', 'schemaHash' => NULL, 'records' => array ( diff --git a/tests/defaultFetchNumeric/config/.phpstan-dba-mysqli.cache b/tests/defaultFetchNumeric/config/.phpstan-dba-mysqli.cache index b817e13f5..396b95b69 100644 --- a/tests/defaultFetchNumeric/config/.phpstan-dba-mysqli.cache +++ b/tests/defaultFetchNumeric/config/.phpstan-dba-mysqli.cache @@ -1,5 +1,5 @@ 'v7-normalized-eol-prepared', + 'schemaVersion' => 'v7-trim-queries', 'schemaHash' => NULL, 'records' => array ( diff --git a/tests/defaultFetchNumeric/config/.phpstan-dba-pdo.cache b/tests/defaultFetchNumeric/config/.phpstan-dba-pdo.cache index b817e13f5..396b95b69 100644 --- a/tests/defaultFetchNumeric/config/.phpstan-dba-pdo.cache +++ b/tests/defaultFetchNumeric/config/.phpstan-dba-pdo.cache @@ -1,5 +1,5 @@ 'v7-normalized-eol-prepared', + 'schemaVersion' => 'v7-trim-queries', 'schemaHash' => NULL, 'records' => array ( diff --git a/tests/defaultFetchNumeric/config/.phpunit-phpstan-dba-mysqli.cache b/tests/defaultFetchNumeric/config/.phpunit-phpstan-dba-mysqli.cache index b817e13f5..396b95b69 100644 --- a/tests/defaultFetchNumeric/config/.phpunit-phpstan-dba-mysqli.cache +++ b/tests/defaultFetchNumeric/config/.phpunit-phpstan-dba-mysqli.cache @@ -1,5 +1,5 @@ 'v7-normalized-eol-prepared', + 'schemaVersion' => 'v7-trim-queries', 'schemaHash' => NULL, 'records' => array ( diff --git a/tests/defaultFetchNumeric/config/.phpunit-phpstan-dba-pdo.cache b/tests/defaultFetchNumeric/config/.phpunit-phpstan-dba-pdo.cache index b817e13f5..396b95b69 100644 --- a/tests/defaultFetchNumeric/config/.phpunit-phpstan-dba-pdo.cache +++ b/tests/defaultFetchNumeric/config/.phpunit-phpstan-dba-pdo.cache @@ -1,5 +1,5 @@ 'v7-normalized-eol-prepared', + 'schemaVersion' => 'v7-trim-queries', 'schemaHash' => NULL, 'records' => array ( diff --git a/tests/rules/config/.phpstan-dba-mysqli.cache b/tests/rules/config/.phpstan-dba-mysqli.cache index e4702b0e5..d12cf4ce5 100644 --- a/tests/rules/config/.phpstan-dba-mysqli.cache +++ b/tests/rules/config/.phpstan-dba-mysqli.cache @@ -1,44 +1,38 @@ 'v7-normalized-eol-prepared', + 'schemaVersion' => 'v7-trim-queries', 'schemaHash' => NULL, 'records' => array ( - ' - SELECT + 'SELECT ada.*, COALESCE(NULLIF(email, ""), email) AS email FROM ada INNER JOIN ak ON (ak.adaid = ada.adaid AND ak.akid = \'1\') - WHERE adaid = 1 ORDER BY COALESCE(NULLIF(email, ""), email) ASC - ' => + WHERE adaid = 1 ORDER BY COALESCE(NULLIF(email, ""), email) ASC' => array ( 'result' => array ( 5 => NULL, ), ), - ' - SELECT + 'SELECT ada.*, COALESCE(NULLIF(email, ""), email) AS email FROM ada INNER JOIN ak ON (ak.adaid = ada.adaid AND ak.akid = :akid) - WHERE adaid = 1 ORDER BY COALESCE(NULLIF(email, ""), email) ASC - ' => + WHERE adaid = 1 ORDER BY COALESCE(NULLIF(email, ""), email) ASC' => array ( 'result' => array ( 5 => NULL, ), ), - ' - SELECT + 'SELECT ada.*, COALESCE(NULLIF(email, ""), email) AS email FROM ada INNER JOIN ak ON (ak.adaid = ada.adaid AND ak.akid = ?) - WHERE adaid = 1 ORDER BY COALESCE(NULLIF(email, ""), email) ASC - ' => + WHERE adaid = 1 ORDER BY COALESCE(NULLIF(email, ""), email) ASC' => array ( 'result' => array ( diff --git a/tests/rules/config/.phpstan-dba-pdo.cache b/tests/rules/config/.phpstan-dba-pdo.cache index e4702b0e5..d12cf4ce5 100644 --- a/tests/rules/config/.phpstan-dba-pdo.cache +++ b/tests/rules/config/.phpstan-dba-pdo.cache @@ -1,44 +1,38 @@ 'v7-normalized-eol-prepared', + 'schemaVersion' => 'v7-trim-queries', 'schemaHash' => NULL, 'records' => array ( - ' - SELECT + 'SELECT ada.*, COALESCE(NULLIF(email, ""), email) AS email FROM ada INNER JOIN ak ON (ak.adaid = ada.adaid AND ak.akid = \'1\') - WHERE adaid = 1 ORDER BY COALESCE(NULLIF(email, ""), email) ASC - ' => + WHERE adaid = 1 ORDER BY COALESCE(NULLIF(email, ""), email) ASC' => array ( 'result' => array ( 5 => NULL, ), ), - ' - SELECT + 'SELECT ada.*, COALESCE(NULLIF(email, ""), email) AS email FROM ada INNER JOIN ak ON (ak.adaid = ada.adaid AND ak.akid = :akid) - WHERE adaid = 1 ORDER BY COALESCE(NULLIF(email, ""), email) ASC - ' => + WHERE adaid = 1 ORDER BY COALESCE(NULLIF(email, ""), email) ASC' => array ( 'result' => array ( 5 => NULL, ), ), - ' - SELECT + 'SELECT ada.*, COALESCE(NULLIF(email, ""), email) AS email FROM ada INNER JOIN ak ON (ak.adaid = ada.adaid AND ak.akid = ?) - WHERE adaid = 1 ORDER BY COALESCE(NULLIF(email, ""), email) ASC - ' => + WHERE adaid = 1 ORDER BY COALESCE(NULLIF(email, ""), email) ASC' => array ( 'result' => array ( diff --git a/tests/rules/config/.phpunit-phpstan-dba-mysqli.cache b/tests/rules/config/.phpunit-phpstan-dba-mysqli.cache index 4a3de6ad4..d5395a1eb 100644 --- a/tests/rules/config/.phpunit-phpstan-dba-mysqli.cache +++ b/tests/rules/config/.phpunit-phpstan-dba-mysqli.cache @@ -1,169 +1,44 @@ 'v7-normalized-eol-prepared', + 'schemaVersion' => 'v7-trim-queries', 'schemaHash' => NULL, 'records' => array ( - ' - SELECT + 'SELECT ada.*, COALESCE(NULLIF(email, ""), email) AS email FROM ada INNER JOIN ak ON (ak.adaid = ada.adaid AND ak.akid = \'1\') - WHERE adaid = 1 ORDER BY COALESCE(NULLIF(email, ""), email) ASC - ' => + WHERE adaid = 1 ORDER BY COALESCE(NULLIF(email, ""), email) ASC' => array ( 'result' => array ( 5 => NULL, ), ), - ' - SELECT + 'SELECT ada.*, COALESCE(NULLIF(email, ""), email) AS email FROM ada INNER JOIN ak ON (ak.adaid = ada.adaid AND ak.akid = :akid) - WHERE adaid = 1 ORDER BY COALESCE(NULLIF(email, ""), email) ASC - ' => + WHERE adaid = 1 ORDER BY COALESCE(NULLIF(email, ""), email) ASC' => array ( 'result' => array ( 5 => NULL, ), ), - ' - SELECT + 'SELECT ada.*, COALESCE(NULLIF(email, ""), email) AS email FROM ada INNER JOIN ak ON (ak.adaid = ada.adaid AND ak.akid = ?) - WHERE adaid = 1 ORDER BY COALESCE(NULLIF(email, ""), email) ASC - ' => + WHERE adaid = 1 ORDER BY COALESCE(NULLIF(email, ""), email) ASC' => array ( 'result' => array ( 5 => NULL, ), ), - ' - SELECT email adaid - WHERE gesperrt = \'1\' AND email LIKE \'%@example.com\' - FROM ada - LIMIT 1 - ' => - array ( - 'error' => - staabm\PHPStanDba\Error::__set_state(array( - 'message' => 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL/MariaDB server version for the right syntax to use near \'FROM ada LIMIT 0\' at line 3', - 'code' => 1064, - )), - ), - ' - SELECT email, adaid - FROM ada - WHERE gesperrt = \'1\' - FOR UPDATE - ' => - array ( - 'error' => NULL, - ), - ' - SELECT email, adaid - FROM ada - WHERE gesperrt = \'1\' - LIMIT \'1\' - ' => - array ( - 'error' => NULL, - ), - ' - SELECT email, adaid - FROM ada - WHERE gesperrt = \'1\' - LIMIT \'1\' - FOR UPDATE - ' => - array ( - 'error' => NULL, - ), - ' - SELECT email, adaid - FROM ada - WHERE gesperrt = \'1\' - LIMIT \'1\' - OFFSET \'1\' - ' => - array ( - 'error' => NULL, - ), - ' - SELECT email, adaid - FROM ada - WHERE gesperrt = \'1\' - LIMIT \'1\' - OFFSET \'1\' - FOR SHARE - ' => - array ( - 'error' => NULL, - ), - ' - SELECT email, adaid - FROM ada - WHERE gesperrt = \'1\' - LIMIT \'1\' - OFFSET \'1\' - FOR UPDATE - ' => - array ( - 'error' => NULL, - ), - ' - SELECT email, adaid - FROM ada - WHERE gesperrt = \'1\' - LIMIT \'1\' - OFFSET 1 - ' => - array ( - 'error' => NULL, - ), - ' - SELECT email, adaid - FROM ada - WHERE gesperrt = \'1\' - LIMIT \'1\', \'1\' - ' => - array ( - 'error' => NULL, - ), - ' - SELECT email, adaid - FROM ada - WHERE gesperrt = \'1\' - LIMIT \'1\', \'1\' - ' => - array ( - 'error' => NULL, - ), - ' - SELECT email, adaid - FROM ada - WHERE gesperrt = \'1\' AND email LIKE \'%@example%\' - LIMIT 1 - ' => - array ( - 'error' => NULL, - ), - ' - SELECT email, adaid - FROM ada - WHERE gesperrt = \'1\' AND email LIKE NULL - LIMIT 1 - ' => - array ( - 'error' => NULL, - ), 'SELECT * FROM ada GROUP BY doesNotExist' => array ( 'error' => @@ -337,6 +212,17 @@ 5 => NULL, ), ), + 'SELECT email adaid + WHERE gesperrt = \'1\' AND email LIKE \'%@example.com\' + FROM ada + LIMIT 1' => + array ( + 'error' => + staabm\PHPStanDba\Error::__set_state(array( + 'message' => 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL/MariaDB server version for the right syntax to use near \'FROM ada LIMIT 0\' at line 3', + 'code' => 1064, + )), + ), 'SELECT email adaid WHERE gesperrt freigabe1u1 FROM ada' => array ( 'error' => @@ -362,6 +248,90 @@ 5 => NULL, ), ), + 'SELECT email, adaid + FROM ada + WHERE gesperrt = \'1\' + FOR UPDATE' => + array ( + 'error' => NULL, + ), + 'SELECT email, adaid + FROM ada + WHERE gesperrt = \'1\' + LIMIT \'1\'' => + array ( + 'error' => NULL, + ), + 'SELECT email, adaid + FROM ada + WHERE gesperrt = \'1\' + LIMIT \'1\' + FOR UPDATE' => + array ( + 'error' => NULL, + ), + 'SELECT email, adaid + FROM ada + WHERE gesperrt = \'1\' + LIMIT \'1\' + OFFSET \'1\'' => + array ( + 'error' => NULL, + ), + 'SELECT email, adaid + FROM ada + WHERE gesperrt = \'1\' + LIMIT \'1\' + OFFSET \'1\' + FOR SHARE' => + array ( + 'error' => NULL, + ), + 'SELECT email, adaid + FROM ada + WHERE gesperrt = \'1\' + LIMIT \'1\' + OFFSET \'1\' + FOR UPDATE' => + array ( + 'error' => NULL, + ), + 'SELECT email, adaid + FROM ada + WHERE gesperrt = \'1\' + LIMIT \'1\' + OFFSET 1' => + array ( + 'error' => NULL, + ), + 'SELECT email, adaid + FROM ada + WHERE gesperrt = \'1\' + LIMIT \'1\', \'1\'' => + array ( + 'error' => NULL, + ), + 'SELECT email, adaid + FROM ada + WHERE gesperrt = \'1\' + LIMIT \'1\', \'1\'' => + array ( + 'error' => NULL, + ), + 'SELECT email, adaid + FROM ada + WHERE gesperrt = \'1\' AND email LIKE \'%@example%\' + LIMIT 1' => + array ( + 'error' => NULL, + ), + 'SELECT email, adaid + FROM ada + WHERE gesperrt = \'1\' AND email LIKE NULL + LIMIT 1' => + array ( + 'error' => NULL, + ), 'SELECT email, adaid FROM ada GROUP BY xy LIMIT 1' => array ( 'error' => @@ -1554,10 +1524,6 @@ array ( 'error' => NULL, ), - 'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada; ' => - array ( - 'error' => NULL, - ), 'SELECT with syntax error GROUPY by x' => array ( 'error' => diff --git a/tests/rules/config/.phpunit-phpstan-dba-pdo.cache b/tests/rules/config/.phpunit-phpstan-dba-pdo.cache index 61294bae6..2e1f6f385 100644 --- a/tests/rules/config/.phpunit-phpstan-dba-pdo.cache +++ b/tests/rules/config/.phpunit-phpstan-dba-pdo.cache @@ -1,169 +1,44 @@ 'v7-normalized-eol-prepared', + 'schemaVersion' => 'v7-trim-queries', 'schemaHash' => NULL, 'records' => array ( - ' - SELECT + 'SELECT ada.*, COALESCE(NULLIF(email, ""), email) AS email FROM ada INNER JOIN ak ON (ak.adaid = ada.adaid AND ak.akid = \'1\') - WHERE adaid = 1 ORDER BY COALESCE(NULLIF(email, ""), email) ASC - ' => + WHERE adaid = 1 ORDER BY COALESCE(NULLIF(email, ""), email) ASC' => array ( 'result' => array ( 5 => NULL, ), ), - ' - SELECT + 'SELECT ada.*, COALESCE(NULLIF(email, ""), email) AS email FROM ada INNER JOIN ak ON (ak.adaid = ada.adaid AND ak.akid = :akid) - WHERE adaid = 1 ORDER BY COALESCE(NULLIF(email, ""), email) ASC - ' => + WHERE adaid = 1 ORDER BY COALESCE(NULLIF(email, ""), email) ASC' => array ( 'result' => array ( 5 => NULL, ), ), - ' - SELECT + 'SELECT ada.*, COALESCE(NULLIF(email, ""), email) AS email FROM ada INNER JOIN ak ON (ak.adaid = ada.adaid AND ak.akid = ?) - WHERE adaid = 1 ORDER BY COALESCE(NULLIF(email, ""), email) ASC - ' => + WHERE adaid = 1 ORDER BY COALESCE(NULLIF(email, ""), email) ASC' => array ( 'result' => array ( 5 => NULL, ), ), - ' - SELECT email adaid - WHERE gesperrt = \'1\' AND email LIKE \'%@example.com\' - FROM ada - LIMIT 1 - ' => - array ( - 'error' => - staabm\PHPStanDba\Error::__set_state(array( - 'message' => 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL/MariaDB server version for the right syntax to use near \'FROM ada LIMIT 0\' at line 3', - 'code' => '42000', - )), - ), - ' - SELECT email, adaid - FROM ada - WHERE gesperrt = \'1\' - FOR UPDATE - ' => - array ( - 'error' => NULL, - ), - ' - SELECT email, adaid - FROM ada - WHERE gesperrt = \'1\' - LIMIT \'1\' - ' => - array ( - 'error' => NULL, - ), - ' - SELECT email, adaid - FROM ada - WHERE gesperrt = \'1\' - LIMIT \'1\' - FOR UPDATE - ' => - array ( - 'error' => NULL, - ), - ' - SELECT email, adaid - FROM ada - WHERE gesperrt = \'1\' - LIMIT \'1\' - OFFSET \'1\' - ' => - array ( - 'error' => NULL, - ), - ' - SELECT email, adaid - FROM ada - WHERE gesperrt = \'1\' - LIMIT \'1\' - OFFSET \'1\' - FOR SHARE - ' => - array ( - 'error' => NULL, - ), - ' - SELECT email, adaid - FROM ada - WHERE gesperrt = \'1\' - LIMIT \'1\' - OFFSET \'1\' - FOR UPDATE - ' => - array ( - 'error' => NULL, - ), - ' - SELECT email, adaid - FROM ada - WHERE gesperrt = \'1\' - LIMIT \'1\' - OFFSET 1 - ' => - array ( - 'error' => NULL, - ), - ' - SELECT email, adaid - FROM ada - WHERE gesperrt = \'1\' - LIMIT \'1\', \'1\' - ' => - array ( - 'error' => NULL, - ), - ' - SELECT email, adaid - FROM ada - WHERE gesperrt = \'1\' - LIMIT \'1\', \'1\' - ' => - array ( - 'error' => NULL, - ), - ' - SELECT email, adaid - FROM ada - WHERE gesperrt = \'1\' AND email LIKE \'%@example%\' - LIMIT 1 - ' => - array ( - 'error' => NULL, - ), - ' - SELECT email, adaid - FROM ada - WHERE gesperrt = \'1\' AND email LIKE NULL - LIMIT 1 - ' => - array ( - 'error' => NULL, - ), 'SELECT * FROM ada GROUP BY doesNotExist' => array ( 'error' => @@ -337,6 +212,17 @@ 5 => NULL, ), ), + 'SELECT email adaid + WHERE gesperrt = \'1\' AND email LIKE \'%@example.com\' + FROM ada + LIMIT 1' => + array ( + 'error' => + staabm\PHPStanDba\Error::__set_state(array( + 'message' => 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL/MariaDB server version for the right syntax to use near \'FROM ada LIMIT 0\' at line 3', + 'code' => '42000', + )), + ), 'SELECT email adaid WHERE gesperrt freigabe1u1 FROM ada' => array ( 'error' => @@ -362,6 +248,90 @@ 5 => NULL, ), ), + 'SELECT email, adaid + FROM ada + WHERE gesperrt = \'1\' + FOR UPDATE' => + array ( + 'error' => NULL, + ), + 'SELECT email, adaid + FROM ada + WHERE gesperrt = \'1\' + LIMIT \'1\'' => + array ( + 'error' => NULL, + ), + 'SELECT email, adaid + FROM ada + WHERE gesperrt = \'1\' + LIMIT \'1\' + FOR UPDATE' => + array ( + 'error' => NULL, + ), + 'SELECT email, adaid + FROM ada + WHERE gesperrt = \'1\' + LIMIT \'1\' + OFFSET \'1\'' => + array ( + 'error' => NULL, + ), + 'SELECT email, adaid + FROM ada + WHERE gesperrt = \'1\' + LIMIT \'1\' + OFFSET \'1\' + FOR SHARE' => + array ( + 'error' => NULL, + ), + 'SELECT email, adaid + FROM ada + WHERE gesperrt = \'1\' + LIMIT \'1\' + OFFSET \'1\' + FOR UPDATE' => + array ( + 'error' => NULL, + ), + 'SELECT email, adaid + FROM ada + WHERE gesperrt = \'1\' + LIMIT \'1\' + OFFSET 1' => + array ( + 'error' => NULL, + ), + 'SELECT email, adaid + FROM ada + WHERE gesperrt = \'1\' + LIMIT \'1\', \'1\'' => + array ( + 'error' => NULL, + ), + 'SELECT email, adaid + FROM ada + WHERE gesperrt = \'1\' + LIMIT \'1\', \'1\'' => + array ( + 'error' => NULL, + ), + 'SELECT email, adaid + FROM ada + WHERE gesperrt = \'1\' AND email LIKE \'%@example%\' + LIMIT 1' => + array ( + 'error' => NULL, + ), + 'SELECT email, adaid + FROM ada + WHERE gesperrt = \'1\' AND email LIKE NULL + LIMIT 1' => + array ( + 'error' => NULL, + ), 'SELECT email, adaid FROM ada GROUP BY xy LIMIT 1' => array ( 'error' => @@ -1554,10 +1524,6 @@ array ( 'error' => NULL, ), - 'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada; ' => - array ( - 'error' => NULL, - ), 'SELECT with syntax error GROUPY by x' => array ( 'error' => diff --git a/tests/stringify/config/.phpstan-dba-mysqli.cache b/tests/stringify/config/.phpstan-dba-mysqli.cache index 03cce1cc4..ab22077ab 100644 --- a/tests/stringify/config/.phpstan-dba-mysqli.cache +++ b/tests/stringify/config/.phpstan-dba-mysqli.cache @@ -1,5 +1,5 @@ 'v7-normalized-eol-prepared', + 'schemaVersion' => 'v7-trim-queries', 'schemaHash' => NULL, 'records' => array ( diff --git a/tests/stringify/config/.phpstan-dba-pdo.cache b/tests/stringify/config/.phpstan-dba-pdo.cache index 03cce1cc4..ab22077ab 100644 --- a/tests/stringify/config/.phpstan-dba-pdo.cache +++ b/tests/stringify/config/.phpstan-dba-pdo.cache @@ -1,5 +1,5 @@ 'v7-normalized-eol-prepared', + 'schemaVersion' => 'v7-trim-queries', 'schemaHash' => NULL, 'records' => array ( diff --git a/tests/stringify/config/.phpunit-phpstan-dba-mysqli.cache b/tests/stringify/config/.phpunit-phpstan-dba-mysqli.cache index 4383d6204..d906bf98f 100644 --- a/tests/stringify/config/.phpunit-phpstan-dba-mysqli.cache +++ b/tests/stringify/config/.phpunit-phpstan-dba-mysqli.cache @@ -1,5 +1,5 @@ 'v7-normalized-eol-prepared', + 'schemaVersion' => 'v7-trim-queries', 'schemaHash' => NULL, 'records' => array ( diff --git a/tests/stringify/config/.phpunit-phpstan-dba-pdo.cache b/tests/stringify/config/.phpunit-phpstan-dba-pdo.cache index 4383d6204..d906bf98f 100644 --- a/tests/stringify/config/.phpunit-phpstan-dba-pdo.cache +++ b/tests/stringify/config/.phpunit-phpstan-dba-pdo.cache @@ -1,5 +1,5 @@ 'v7-normalized-eol-prepared', + 'schemaVersion' => 'v7-trim-queries', 'schemaHash' => NULL, 'records' => array (