diff --git a/.phpstan-dba-mysqli.cache b/.phpstan-dba-mysqli.cache index c121430ea..5c0682125 100644 --- a/.phpstan-dba-mysqli.cache +++ b/.phpstan-dba-mysqli.cache @@ -216,8 +216,8 @@ MD5( GROUP_CONCAT( CONCAT( - COALESCE(COLUMN_NAME, ""), - COALESCE(EXTRA, ""), + COALESCE(COLUMN_NAME, \'\'), + COALESCE(EXTRA, \'\'), COLUMN_TYPE, IS_NULLABLE ) @@ -542,8 +542,8 @@ ), ), 'SELECT - coalesce(COLUMN_NAME, "") as COLUMN_NAME, - coalesce(EXTRA, "") as EXTRA, + 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()' => @@ -652,8 +652,8 @@ ), ), 'SELECT - coalesce(COLUMN_NAME, "") as COLUMN_NAME, - coalesce(EXTRA, "") as EXTRA, + coalesce(COLUMN_NAME, \'\') as COLUMN_NAME, + coalesce(EXTRA, \'\') as EXTRA, COLUMN_TYPE FROM information_schema.columns WHERE table_name = ? AND table_schema = DATABASE()' => diff --git a/.phpstan-dba-pdo.cache b/.phpstan-dba-pdo.cache index b1ac86c20..6de7fb3ff 100644 --- a/.phpstan-dba-pdo.cache +++ b/.phpstan-dba-pdo.cache @@ -216,8 +216,8 @@ MD5( GROUP_CONCAT( CONCAT( - COALESCE(COLUMN_NAME, ""), - COALESCE(EXTRA, ""), + COALESCE(COLUMN_NAME, \'\'), + COALESCE(EXTRA, \'\'), COLUMN_TYPE, IS_NULLABLE ) @@ -542,8 +542,8 @@ ), ), 'SELECT - coalesce(COLUMN_NAME, "") as COLUMN_NAME, - coalesce(EXTRA, "") as EXTRA, + 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()' => @@ -652,8 +652,8 @@ ), ), 'SELECT - coalesce(COLUMN_NAME, "") as COLUMN_NAME, - coalesce(EXTRA, "") as EXTRA, + coalesce(COLUMN_NAME, \'\') as COLUMN_NAME, + coalesce(EXTRA, \'\') as EXTRA, COLUMN_TYPE FROM information_schema.columns WHERE table_name = ? AND table_schema = DATABASE()' => diff --git a/tests/default/config/.phpstan-dba-mysqli.cache b/tests/default/config/.phpstan-dba-mysqli.cache index 481f30412..b1d2b348c 100644 --- a/tests/default/config/.phpstan-dba-mysqli.cache +++ b/tests/default/config/.phpstan-dba-mysqli.cache @@ -2456,6 +2456,69 @@ )), ), ), + 'SELECT adaid FROM ada WHERE email LIKE \'hello?%\'' => + array ( + 'result' => + array ( + 5 => + PHPStan\Type\Constant\ConstantArrayType::__set_state(array( + 'allArrays' => NULL, + 'nextAutoIndexes' => + array ( + 0 => 1, + ), + 'keyTypes' => + array ( + 0 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'value' => 'adaid', + 'isClassString' => false, + )), + 1 => + PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( + 'value' => 0, + )), + ), + 'valueTypes' => + array ( + 0 => + PHPStan\Type\IntegerRangeType::__set_state(array( + 'min' => -32768, + 'max' => 32767, + )), + 1 => + PHPStan\Type\IntegerRangeType::__set_state(array( + 'min' => -32768, + 'max' => 32767, + )), + ), + '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\ConstantStringType::__set_state(array( + 'value' => 'adaid', + 'isClassString' => false, + )), + ), + )), + 'itemType' => + PHPStan\Type\IntegerRangeType::__set_state(array( + 'min' => -32768, + 'max' => 32767, + )), + )), + ), + ), 'SELECT akid FROM ak WHERE eadavk>1.0' => array ( 'result' => diff --git a/tests/default/config/.phpstan-dba-pdo.cache b/tests/default/config/.phpstan-dba-pdo.cache index 481f30412..b1d2b348c 100644 --- a/tests/default/config/.phpstan-dba-pdo.cache +++ b/tests/default/config/.phpstan-dba-pdo.cache @@ -2456,6 +2456,69 @@ )), ), ), + 'SELECT adaid FROM ada WHERE email LIKE \'hello?%\'' => + array ( + 'result' => + array ( + 5 => + PHPStan\Type\Constant\ConstantArrayType::__set_state(array( + 'allArrays' => NULL, + 'nextAutoIndexes' => + array ( + 0 => 1, + ), + 'keyTypes' => + array ( + 0 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'value' => 'adaid', + 'isClassString' => false, + )), + 1 => + PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( + 'value' => 0, + )), + ), + 'valueTypes' => + array ( + 0 => + PHPStan\Type\IntegerRangeType::__set_state(array( + 'min' => -32768, + 'max' => 32767, + )), + 1 => + PHPStan\Type\IntegerRangeType::__set_state(array( + 'min' => -32768, + 'max' => 32767, + )), + ), + '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\ConstantStringType::__set_state(array( + 'value' => 'adaid', + 'isClassString' => false, + )), + ), + )), + 'itemType' => + PHPStan\Type\IntegerRangeType::__set_state(array( + 'min' => -32768, + 'max' => 32767, + )), + )), + ), + ), 'SELECT akid FROM ak WHERE eadavk>1.0' => array ( 'result' => diff --git a/tests/default/config/.phpunit-phpstan-dba-mysqli.cache b/tests/default/config/.phpunit-phpstan-dba-mysqli.cache index 369604c02..f7b0b2e14 100644 --- a/tests/default/config/.phpunit-phpstan-dba-mysqli.cache +++ b/tests/default/config/.phpunit-phpstan-dba-mysqli.cache @@ -2744,6 +2744,69 @@ )), ), ), + 'SELECT adaid FROM ada WHERE email LIKE \'hello?%\'' => + array ( + 'result' => + array ( + 5 => + PHPStan\Type\Constant\ConstantArrayType::__set_state(array( + 'allArrays' => NULL, + 'nextAutoIndexes' => + array ( + 0 => 1, + ), + 'keyTypes' => + array ( + 0 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'value' => 'adaid', + 'isClassString' => false, + )), + 1 => + PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( + 'value' => 0, + )), + ), + 'valueTypes' => + array ( + 0 => + PHPStan\Type\IntegerRangeType::__set_state(array( + 'min' => -32768, + 'max' => 32767, + )), + 1 => + PHPStan\Type\IntegerRangeType::__set_state(array( + 'min' => -32768, + 'max' => 32767, + )), + ), + '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\ConstantStringType::__set_state(array( + 'value' => 'adaid', + 'isClassString' => false, + )), + ), + )), + 'itemType' => + PHPStan\Type\IntegerRangeType::__set_state(array( + 'min' => -32768, + 'max' => 32767, + )), + )), + ), + ), 'SELECT akid FROM ak WHERE eadavk>1.0' => array ( 'result' => diff --git a/tests/default/config/.phpunit-phpstan-dba-pdo.cache b/tests/default/config/.phpunit-phpstan-dba-pdo.cache index 0bacc0390..3fd1f43c1 100644 --- a/tests/default/config/.phpunit-phpstan-dba-pdo.cache +++ b/tests/default/config/.phpunit-phpstan-dba-pdo.cache @@ -2456,6 +2456,69 @@ )), ), ), + 'SELECT adaid FROM ada WHERE email LIKE \'hello?%\'' => + array ( + 'result' => + array ( + 5 => + PHPStan\Type\Constant\ConstantArrayType::__set_state(array( + 'allArrays' => NULL, + 'nextAutoIndexes' => + array ( + 0 => 1, + ), + 'keyTypes' => + array ( + 0 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'value' => 'adaid', + 'isClassString' => false, + )), + 1 => + PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( + 'value' => 0, + )), + ), + 'valueTypes' => + array ( + 0 => + PHPStan\Type\IntegerRangeType::__set_state(array( + 'min' => -32768, + 'max' => 32767, + )), + 1 => + PHPStan\Type\IntegerRangeType::__set_state(array( + 'min' => -32768, + 'max' => 32767, + )), + ), + '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\ConstantStringType::__set_state(array( + 'value' => 'adaid', + 'isClassString' => false, + )), + ), + )), + 'itemType' => + PHPStan\Type\IntegerRangeType::__set_state(array( + 'min' => -32768, + 'max' => 32767, + )), + )), + ), + ), 'SELECT akid FROM ak WHERE eadavk>1.0' => array ( 'result' => diff --git a/tests/default/data/pdo-prepare.php b/tests/default/data/pdo-prepare.php index d9fa9b9e6..dfb773d39 100644 --- a/tests/default/data/pdo-prepare.php +++ b/tests/default/data/pdo-prepare.php @@ -49,7 +49,7 @@ public function queryBranches(PDO $pdo, bool $bool) public function placeholderInData(PDO $pdo) { - $query = 'SELECT adaid FROM ada WHERE email LIKE "hello?%"'; + $query = "SELECT adaid FROM ada WHERE email LIKE 'hello?%'"; $stmt = $pdo->prepare($query); assertType('PDOStatement, 0: int<-32768, 32767>}>', $stmt); $stmt->execute(); diff --git a/tests/default/data/pdo.php b/tests/default/data/pdo.php index 1a1f0d67f..a944d5681 100644 --- a/tests/default/data/pdo.php +++ b/tests/default/data/pdo.php @@ -158,7 +158,7 @@ public function aggregateFunctions(PDO $pdo) public function placeholderInData(PDO $pdo) { - $query = 'SELECT adaid FROM ada WHERE email LIKE "hello?%"'; + $query = "SELECT adaid FROM ada WHERE email LIKE 'hello?%'"; $stmt = $pdo->query($query, PDO::FETCH_ASSOC); assertType('PDOStatement}>', $stmt); diff --git a/tests/rules/config/.phpunit-phpstan-dba-mysqli.cache b/tests/rules/config/.phpunit-phpstan-dba-mysqli.cache index 6f22efca3..75a2ef2a0 100644 --- a/tests/rules/config/.phpunit-phpstan-dba-mysqli.cache +++ b/tests/rules/config/.phpunit-phpstan-dba-mysqli.cache @@ -16,112 +16,6 @@ '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 email adaid WHERE gesperrt = \'1\' AND email LIKE \'%@example.com\' @@ -297,6 +191,10 @@ array ( 'error' => NULL, ), + 'SELECT adaid FROM ada WHERE email LIKE \'hello?%\'' => + array ( + 'error' => NULL, + ), 'SELECT adaid FROM ada WHERE email LIKE \'some strange string - :gesperrt it is\'' => array ( 'error' => NULL, @@ -362,11 +260,6 @@ array ( 'error' => NULL, ), - 'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada - WHERE (gesperrt=\'1\' AND freigabe1u1=1) OR (gesperrt=\'1\' AND freigabe1u1=0)' => - array ( - 'error' => NULL, - ), 'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada LIMIT 1' => array ( 'error' => NULL, diff --git a/tests/rules/config/.phpunit-phpstan-dba-pdo.cache b/tests/rules/config/.phpunit-phpstan-dba-pdo.cache index 14d33811c..7d108be0f 100644 --- a/tests/rules/config/.phpunit-phpstan-dba-pdo.cache +++ b/tests/rules/config/.phpunit-phpstan-dba-pdo.cache @@ -16,112 +16,6 @@ '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 email adaid WHERE gesperrt = \'1\' AND email LIKE \'%@example.com\' @@ -297,6 +191,10 @@ array ( 'error' => NULL, ), + 'SELECT adaid FROM ada WHERE email LIKE \'hello?%\'' => + array ( + 'error' => NULL, + ), 'SELECT adaid FROM ada WHERE email LIKE \'some strange string - :gesperrt it is\'' => array ( 'error' => NULL, @@ -362,11 +260,6 @@ array ( 'error' => NULL, ), - 'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada - WHERE (gesperrt=\'1\' AND freigabe1u1=1) OR (gesperrt=\'1\' AND freigabe1u1=0)' => - array ( - 'error' => NULL, - ), 'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada LIMIT 1' => array ( 'error' => NULL, diff --git a/tests/rules/data/syntax-error-in-prepared-statement.php b/tests/rules/data/syntax-error-in-prepared-statement.php index 99e837226..833973c7d 100644 --- a/tests/rules/data/syntax-error-in-prepared-statement.php +++ b/tests/rules/data/syntax-error-in-prepared-statement.php @@ -152,7 +152,7 @@ public function noErrorOnTraillingSemicolon(Connection $connection) public function noErrorOnPlaceholderInData(Connection $connection) { - $query = 'SELECT adaid FROM ada WHERE email LIKE "hello?%"'; + $query = "SELECT adaid FROM ada WHERE email LIKE 'hello?%'"; $connection->preparedQuery($query, []); $query = "SELECT adaid FROM ada WHERE email LIKE '%questions ?%'";