From f5f9359547cca1ad492676c5b25fd2e4d66288da Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sat, 22 Jan 2022 10:20:42 +0100 Subject: [PATCH 1/5] added failling test --- tests/data/syntax-error-in-prepared-statement.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/data/syntax-error-in-prepared-statement.php b/tests/data/syntax-error-in-prepared-statement.php index 956d037aa..bd39a907a 100644 --- a/tests/data/syntax-error-in-prepared-statement.php +++ b/tests/data/syntax-error-in-prepared-statement.php @@ -282,4 +282,15 @@ public function noErrorOnLockedRead(Connection $connection, int $limit, int $off FOR SHARE ', [':gesperrt' => 1, ':limit' => $limit, ':offset' => $offset]); } + + public function noErrorInBug174(Connection $connection, string $name, ?int $gesperrt = null) { + $sql = 'SELECT adaid FROM ada WHERE email = :name'; + $args = ['name' => $name]; + if (null !== $gesperrt) { + $sql .= ' AND gesperrt = :gesperrt'; + $args['gesperrt'] = $gesperrt; + } + + $connection->preparedQuery($sql, $args); + } } From f6648a18f49850ea496d9599dc99498e548a71fb Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sat, 22 Jan 2022 11:26:03 +0100 Subject: [PATCH 2/5] more complete test --- tests/data/syntax-error-in-prepared-statement.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/data/syntax-error-in-prepared-statement.php b/tests/data/syntax-error-in-prepared-statement.php index bd39a907a..ce04fb894 100644 --- a/tests/data/syntax-error-in-prepared-statement.php +++ b/tests/data/syntax-error-in-prepared-statement.php @@ -283,13 +283,17 @@ public function noErrorOnLockedRead(Connection $connection, int $limit, int $off ', [':gesperrt' => 1, ':limit' => $limit, ':offset' => $offset]); } - public function noErrorInBug174(Connection $connection, string $name, ?int $gesperrt = null) { + public function noErrorInBug174(Connection $connection, string $name, ?int $gesperrt = null, ?int $adaid = null) { $sql = 'SELECT adaid FROM ada WHERE email = :name'; $args = ['name' => $name]; if (null !== $gesperrt) { $sql .= ' AND gesperrt = :gesperrt'; $args['gesperrt'] = $gesperrt; } + if (null !== $adaid) { + $sql .= ' AND adaid = :adaid'; + $args['adaid'] = $adaid; + } $connection->preparedQuery($sql, $args); } From 9b2301b3d144cf6b5d84a37e7aab4bcfde40564f Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sat, 22 Jan 2022 17:51:03 +0100 Subject: [PATCH 3/5] reduce test-case --- tests/data/syntax-error-in-prepared-statement.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/data/syntax-error-in-prepared-statement.php b/tests/data/syntax-error-in-prepared-statement.php index ce04fb894..2fc89fb3d 100644 --- a/tests/data/syntax-error-in-prepared-statement.php +++ b/tests/data/syntax-error-in-prepared-statement.php @@ -290,10 +290,6 @@ public function noErrorInBug174(Connection $connection, string $name, ?int $gesp $sql .= ' AND gesperrt = :gesperrt'; $args['gesperrt'] = $gesperrt; } - if (null !== $adaid) { - $sql .= ' AND adaid = :adaid'; - $args['adaid'] = $adaid; - } $connection->preparedQuery($sql, $args); } From 4b91186b9e4af1061fcd200b5c6cd69d6eb37e78 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sun, 23 Jan 2022 10:44:22 +0100 Subject: [PATCH 4/5] fix --- .phpstan-dba.cache | 440 ------------------ .phpunit-phpstan-dba.cache | 49 ++ src/QueryReflection/PlaceholderValidation.php | 26 +- 3 files changed, 69 insertions(+), 446 deletions(-) diff --git a/.phpstan-dba.cache b/.phpstan-dba.cache index 95ec9ffff..f1a9c976c 100644 --- a/.phpstan-dba.cache +++ b/.phpstan-dba.cache @@ -1537,59 +1537,6 @@ 'error' => NULL, 'result' => array ( - 3 => - PHPStan\Type\Constant\ConstantArrayType::__set_state(array( - 'keyType' => - PHPStan\Type\UnionType::__set_state(array( - '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' => 0, - 'max' => 4294967295, - )), - 'allArrays' => NULL, - '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' => 0, - 'max' => 4294967295, - )), - 1 => - PHPStan\Type\IntegerRangeType::__set_state(array( - 'min' => 0, - 'max' => 4294967295, - )), - ), - 'nextAutoIndex' => 1, - 'optionalKeys' => - array ( - ), - )), 1 => PHPStan\Type\Constant\ConstantArrayType::__set_state(array( 'keyType' => @@ -1713,59 +1660,6 @@ 'error' => NULL, 'result' => array ( - 3 => - PHPStan\Type\Constant\ConstantArrayType::__set_state(array( - 'keyType' => - PHPStan\Type\UnionType::__set_state(array( - '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' => 0, - 'max' => 4294967295, - )), - 'allArrays' => NULL, - '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' => 0, - 'max' => 4294967295, - )), - 1 => - PHPStan\Type\IntegerRangeType::__set_state(array( - 'min' => 0, - 'max' => 4294967295, - )), - ), - 'nextAutoIndex' => 1, - 'optionalKeys' => - array ( - ), - )), 1 => PHPStan\Type\Constant\ConstantArrayType::__set_state(array( 'keyType' => @@ -1867,59 +1761,6 @@ 'error' => NULL, 'result' => array ( - 3 => - PHPStan\Type\Constant\ConstantArrayType::__set_state(array( - 'keyType' => - PHPStan\Type\UnionType::__set_state(array( - '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' => 0, - 'max' => 4294967295, - )), - 'allArrays' => NULL, - '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' => 0, - 'max' => 4294967295, - )), - 1 => - PHPStan\Type\IntegerRangeType::__set_state(array( - 'min' => 0, - 'max' => 4294967295, - )), - ), - 'nextAutoIndex' => 1, - 'optionalKeys' => - array ( - ), - )), 1 => PHPStan\Type\Constant\ConstantArrayType::__set_state(array( 'keyType' => @@ -1961,59 +1802,6 @@ 'error' => NULL, 'result' => array ( - 3 => - PHPStan\Type\Constant\ConstantArrayType::__set_state(array( - 'keyType' => - PHPStan\Type\UnionType::__set_state(array( - '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' => 0, - 'max' => 4294967295, - )), - 'allArrays' => NULL, - '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' => 0, - 'max' => 4294967295, - )), - 1 => - PHPStan\Type\IntegerRangeType::__set_state(array( - 'min' => 0, - 'max' => 4294967295, - )), - ), - 'nextAutoIndex' => 1, - 'optionalKeys' => - array ( - ), - )), 1 => PHPStan\Type\Constant\ConstantArrayType::__set_state(array( 'keyType' => @@ -2743,8 +2531,6 @@ 'result' => array ( 1 => NULL, - 2 => NULL, - 3 => NULL, ), ), 'SELECT email adaid WHERE gesperrt freigabe1u1 FROM ada gesperrt=' => @@ -4291,148 +4077,6 @@ Simulated query: SELECT email, adaid GROUP BY xy FROM ada LIMIT 0', 'error' => NULL, 'result' => array ( - 3 => - PHPStan\Type\Constant\ConstantArrayType::__set_state(array( - 'keyType' => - PHPStan\Type\UnionType::__set_state(array( - '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\ConstantIntegerType::__set_state(array( - 'value' => 3, - )), - 4 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'value' => 'adaid', - 'isClassString' => false, - )), - 5 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'value' => 'email', - 'isClassString' => false, - )), - 6 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'value' => 'freigabe1u1', - 'isClassString' => false, - )), - 7 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'value' => 'gesperrt', - 'isClassString' => false, - )), - ), - )), - 'itemType' => - PHPStan\Type\UnionType::__set_state(array( - 'types' => - array ( - 0 => - PHPStan\Type\IntegerRangeType::__set_state(array( - 'min' => -128, - 'max' => 4294967295, - )), - 1 => - PHPStan\Type\StringType::__set_state(array( - )), - ), - )), - 'allArrays' => NULL, - 'keyTypes' => - array ( - 0 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'value' => 'email', - 'isClassString' => false, - )), - 1 => - PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( - 'value' => 0, - )), - 2 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'value' => 'adaid', - 'isClassString' => false, - )), - 3 => - PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( - 'value' => 1, - )), - 4 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'value' => 'gesperrt', - 'isClassString' => false, - )), - 5 => - PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( - 'value' => 2, - )), - 6 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'value' => 'freigabe1u1', - 'isClassString' => false, - )), - 7 => - PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( - 'value' => 3, - )), - ), - 'valueTypes' => - array ( - 0 => - PHPStan\Type\StringType::__set_state(array( - )), - 1 => - PHPStan\Type\StringType::__set_state(array( - )), - 2 => - PHPStan\Type\IntegerRangeType::__set_state(array( - 'min' => 0, - 'max' => 4294967295, - )), - 3 => - PHPStan\Type\IntegerRangeType::__set_state(array( - 'min' => 0, - 'max' => 4294967295, - )), - 4 => - PHPStan\Type\IntegerRangeType::__set_state(array( - 'min' => -128, - 'max' => 127, - )), - 5 => - PHPStan\Type\IntegerRangeType::__set_state(array( - 'min' => -128, - 'max' => 127, - )), - 6 => - PHPStan\Type\IntegerRangeType::__set_state(array( - 'min' => -128, - 'max' => 127, - )), - 7 => - PHPStan\Type\IntegerRangeType::__set_state(array( - 'min' => -128, - 'max' => 127, - )), - ), - 'nextAutoIndex' => 4, - 'optionalKeys' => - array ( - ), - )), 1 => PHPStan\Type\Constant\ConstantArrayType::__set_state(array( 'keyType' => @@ -4525,90 +4169,6 @@ Simulated query: SELECT email, adaid GROUP BY xy FROM ada LIMIT 0', array ( ), )), - 2 => - PHPStan\Type\Constant\ConstantArrayType::__set_state(array( - 'keyType' => - PHPStan\Type\UnionType::__set_state(array( - '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\ConstantIntegerType::__set_state(array( - 'value' => 3, - )), - ), - )), - 'itemType' => - PHPStan\Type\UnionType::__set_state(array( - 'types' => - array ( - 0 => - PHPStan\Type\IntegerRangeType::__set_state(array( - 'min' => -128, - 'max' => 4294967295, - )), - 1 => - PHPStan\Type\StringType::__set_state(array( - )), - ), - )), - 'allArrays' => NULL, - 'keyTypes' => - 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\ConstantIntegerType::__set_state(array( - 'value' => 3, - )), - ), - 'valueTypes' => - array ( - 0 => - PHPStan\Type\StringType::__set_state(array( - )), - 1 => - PHPStan\Type\IntegerRangeType::__set_state(array( - 'min' => 0, - 'max' => 4294967295, - )), - 2 => - PHPStan\Type\IntegerRangeType::__set_state(array( - 'min' => -128, - 'max' => 127, - )), - 3 => - PHPStan\Type\IntegerRangeType::__set_state(array( - 'min' => -128, - 'max' => 127, - )), - ), - 'nextAutoIndex' => 4, - 'optionalKeys' => - array ( - ), - )), ), ), 'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada LIMIT 1' => diff --git a/.phpunit-phpstan-dba.cache b/.phpunit-phpstan-dba.cache index 20205713b..c75394da6 100644 --- a/.phpunit-phpstan-dba.cache +++ b/.phpunit-phpstan-dba.cache @@ -134,11 +134,30 @@ '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, @@ -153,6 +172,28 @@ 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 @@ -1537,6 +1578,14 @@ )), ), ), + 'SELECT adaid FROM ada WHERE email = \'1\'' => + array ( + 'error' => NULL, + ), + 'SELECT adaid FROM ada WHERE email = \'1\' AND gesperrt = \'1\'' => + array ( + 'error' => NULL, + ), 'SELECT adaid FROM ada WHERE email LIKE ":gesperrt%"' => array ( 'error' => NULL, diff --git a/src/QueryReflection/PlaceholderValidation.php b/src/QueryReflection/PlaceholderValidation.php index 144b93e1a..4a2d87074 100644 --- a/src/QueryReflection/PlaceholderValidation.php +++ b/src/QueryReflection/PlaceholderValidation.php @@ -39,7 +39,7 @@ public function checkErrors(string $queryString, array $parameters): iterable } /** - * @param array $parameters + * @param non-empty-array $parameters * * @return iterable */ @@ -48,16 +48,27 @@ private function checkParameterValues(string $queryString, array $parameters, in $queryReflection = new QueryReflection(); $parameterCount = \count($parameters); + $minParameterCount = 0; + foreach ($parameters as $parameter) { + if ($parameter->isOptional) { + continue; + } + ++$minParameterCount; + } - if ($parameterCount !== $placeholderCount) { + if ($parameterCount !== $placeholderCount && $placeholderCount !== $minParameterCount) { $placeholderExpectation = sprintf('Query expects %s placeholder', $placeholderCount); if ($placeholderCount > 1) { $placeholderExpectation = sprintf('Query expects %s placeholders', $placeholderCount); } - $parameterActual = sprintf('but %s value is given', $parameterCount); - if ($parameterCount > 1) { - $parameterActual = sprintf('but %s values are given', $parameterCount); + if ($minParameterCount !== $parameterCount) { + $parameterActual = sprintf('but %s values are given', $minParameterCount.'-'.$parameterCount); + } else { + $parameterActual = sprintf('but %s value is given', $parameterCount); + if ($parameterCount > 1) { + $parameterActual = sprintf('but %s values are given', $parameterCount); + } } yield $placeholderExpectation.', '.$parameterActual.'.'; @@ -72,10 +83,13 @@ private function checkParameterValues(string $queryString, array $parameters, in } } - foreach ($parameters as $placeholderKey => $value) { + foreach ($parameters as $placeholderKey => $parameter) { if (\is_int($placeholderKey)) { continue; } + if ($parameter->isOptional) { + continue; + } if (!\in_array($placeholderKey, $namedPlaceholders)) { yield sprintf('Value %s is given, but the query does not contain this placeholder.', $placeholderKey); } From ef68ba111665e5f200c4a07363d95978ceb8a525 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sun, 23 Jan 2022 11:04:03 +0100 Subject: [PATCH 5/5] Update .phpstan-dba.cache --- .phpstan-dba.cache | 440 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 440 insertions(+) diff --git a/.phpstan-dba.cache b/.phpstan-dba.cache index f1a9c976c..95ec9ffff 100644 --- a/.phpstan-dba.cache +++ b/.phpstan-dba.cache @@ -1537,6 +1537,59 @@ 'error' => NULL, 'result' => array ( + 3 => + PHPStan\Type\Constant\ConstantArrayType::__set_state(array( + 'keyType' => + PHPStan\Type\UnionType::__set_state(array( + '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' => 0, + 'max' => 4294967295, + )), + 'allArrays' => NULL, + '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' => 0, + 'max' => 4294967295, + )), + 1 => + PHPStan\Type\IntegerRangeType::__set_state(array( + 'min' => 0, + 'max' => 4294967295, + )), + ), + 'nextAutoIndex' => 1, + 'optionalKeys' => + array ( + ), + )), 1 => PHPStan\Type\Constant\ConstantArrayType::__set_state(array( 'keyType' => @@ -1660,6 +1713,59 @@ 'error' => NULL, 'result' => array ( + 3 => + PHPStan\Type\Constant\ConstantArrayType::__set_state(array( + 'keyType' => + PHPStan\Type\UnionType::__set_state(array( + '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' => 0, + 'max' => 4294967295, + )), + 'allArrays' => NULL, + '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' => 0, + 'max' => 4294967295, + )), + 1 => + PHPStan\Type\IntegerRangeType::__set_state(array( + 'min' => 0, + 'max' => 4294967295, + )), + ), + 'nextAutoIndex' => 1, + 'optionalKeys' => + array ( + ), + )), 1 => PHPStan\Type\Constant\ConstantArrayType::__set_state(array( 'keyType' => @@ -1761,6 +1867,59 @@ 'error' => NULL, 'result' => array ( + 3 => + PHPStan\Type\Constant\ConstantArrayType::__set_state(array( + 'keyType' => + PHPStan\Type\UnionType::__set_state(array( + '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' => 0, + 'max' => 4294967295, + )), + 'allArrays' => NULL, + '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' => 0, + 'max' => 4294967295, + )), + 1 => + PHPStan\Type\IntegerRangeType::__set_state(array( + 'min' => 0, + 'max' => 4294967295, + )), + ), + 'nextAutoIndex' => 1, + 'optionalKeys' => + array ( + ), + )), 1 => PHPStan\Type\Constant\ConstantArrayType::__set_state(array( 'keyType' => @@ -1802,6 +1961,59 @@ 'error' => NULL, 'result' => array ( + 3 => + PHPStan\Type\Constant\ConstantArrayType::__set_state(array( + 'keyType' => + PHPStan\Type\UnionType::__set_state(array( + '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' => 0, + 'max' => 4294967295, + )), + 'allArrays' => NULL, + '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' => 0, + 'max' => 4294967295, + )), + 1 => + PHPStan\Type\IntegerRangeType::__set_state(array( + 'min' => 0, + 'max' => 4294967295, + )), + ), + 'nextAutoIndex' => 1, + 'optionalKeys' => + array ( + ), + )), 1 => PHPStan\Type\Constant\ConstantArrayType::__set_state(array( 'keyType' => @@ -2531,6 +2743,8 @@ 'result' => array ( 1 => NULL, + 2 => NULL, + 3 => NULL, ), ), 'SELECT email adaid WHERE gesperrt freigabe1u1 FROM ada gesperrt=' => @@ -4077,6 +4291,148 @@ Simulated query: SELECT email, adaid GROUP BY xy FROM ada LIMIT 0', 'error' => NULL, 'result' => array ( + 3 => + PHPStan\Type\Constant\ConstantArrayType::__set_state(array( + 'keyType' => + PHPStan\Type\UnionType::__set_state(array( + '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\ConstantIntegerType::__set_state(array( + 'value' => 3, + )), + 4 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'value' => 'adaid', + 'isClassString' => false, + )), + 5 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'value' => 'email', + 'isClassString' => false, + )), + 6 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'value' => 'freigabe1u1', + 'isClassString' => false, + )), + 7 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'value' => 'gesperrt', + 'isClassString' => false, + )), + ), + )), + 'itemType' => + PHPStan\Type\UnionType::__set_state(array( + 'types' => + array ( + 0 => + PHPStan\Type\IntegerRangeType::__set_state(array( + 'min' => -128, + 'max' => 4294967295, + )), + 1 => + PHPStan\Type\StringType::__set_state(array( + )), + ), + )), + 'allArrays' => NULL, + 'keyTypes' => + array ( + 0 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'value' => 'email', + 'isClassString' => false, + )), + 1 => + PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( + 'value' => 0, + )), + 2 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'value' => 'adaid', + 'isClassString' => false, + )), + 3 => + PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( + 'value' => 1, + )), + 4 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'value' => 'gesperrt', + 'isClassString' => false, + )), + 5 => + PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( + 'value' => 2, + )), + 6 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'value' => 'freigabe1u1', + 'isClassString' => false, + )), + 7 => + PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( + 'value' => 3, + )), + ), + 'valueTypes' => + array ( + 0 => + PHPStan\Type\StringType::__set_state(array( + )), + 1 => + PHPStan\Type\StringType::__set_state(array( + )), + 2 => + PHPStan\Type\IntegerRangeType::__set_state(array( + 'min' => 0, + 'max' => 4294967295, + )), + 3 => + PHPStan\Type\IntegerRangeType::__set_state(array( + 'min' => 0, + 'max' => 4294967295, + )), + 4 => + PHPStan\Type\IntegerRangeType::__set_state(array( + 'min' => -128, + 'max' => 127, + )), + 5 => + PHPStan\Type\IntegerRangeType::__set_state(array( + 'min' => -128, + 'max' => 127, + )), + 6 => + PHPStan\Type\IntegerRangeType::__set_state(array( + 'min' => -128, + 'max' => 127, + )), + 7 => + PHPStan\Type\IntegerRangeType::__set_state(array( + 'min' => -128, + 'max' => 127, + )), + ), + 'nextAutoIndex' => 4, + 'optionalKeys' => + array ( + ), + )), 1 => PHPStan\Type\Constant\ConstantArrayType::__set_state(array( 'keyType' => @@ -4169,6 +4525,90 @@ Simulated query: SELECT email, adaid GROUP BY xy FROM ada LIMIT 0', array ( ), )), + 2 => + PHPStan\Type\Constant\ConstantArrayType::__set_state(array( + 'keyType' => + PHPStan\Type\UnionType::__set_state(array( + '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\ConstantIntegerType::__set_state(array( + 'value' => 3, + )), + ), + )), + 'itemType' => + PHPStan\Type\UnionType::__set_state(array( + 'types' => + array ( + 0 => + PHPStan\Type\IntegerRangeType::__set_state(array( + 'min' => -128, + 'max' => 4294967295, + )), + 1 => + PHPStan\Type\StringType::__set_state(array( + )), + ), + )), + 'allArrays' => NULL, + 'keyTypes' => + 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\ConstantIntegerType::__set_state(array( + 'value' => 3, + )), + ), + 'valueTypes' => + array ( + 0 => + PHPStan\Type\StringType::__set_state(array( + )), + 1 => + PHPStan\Type\IntegerRangeType::__set_state(array( + 'min' => 0, + 'max' => 4294967295, + )), + 2 => + PHPStan\Type\IntegerRangeType::__set_state(array( + 'min' => -128, + 'max' => 127, + )), + 3 => + PHPStan\Type\IntegerRangeType::__set_state(array( + 'min' => -128, + 'max' => 127, + )), + ), + 'nextAutoIndex' => 4, + 'optionalKeys' => + array ( + ), + )), ), ), 'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada LIMIT 1' =>