From 0b2e8aa3c6659f8bf2d33ee8a5730d409f8238a2 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Fri, 17 Feb 2023 17:20:28 +0100 Subject: [PATCH 1/2] Cover `count(*)` in tests --- .phpstan-dba-mysqli.cache | 742 ++--------------------- tests/default/data/sql-ast-narrowing.php | 3 + 2 files changed, 70 insertions(+), 675 deletions(-) diff --git a/.phpstan-dba-mysqli.cache b/.phpstan-dba-mysqli.cache index ea4c79acc..d3faea9e0 100644 --- a/.phpstan-dba-mysqli.cache +++ b/.phpstan-dba-mysqli.cache @@ -3,474 +3,6 @@ 'schemaHash' => '978ac93a0dacd29d0a93b7827aa3319c', 'records' => array ( - '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( - 'keyType' => - PHPStan\Type\UnionType::__set_state(array( - 'sortedTypes' => true, - 'cachedDescriptions' => - array ( - 2 => '0|1|2|\'COLUMN_NAME\'|\'COLUMN_TYPE\'|\'EXTRA\'', - 1 => 'int|string', - ), - '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( - 'objectType' => NULL, - 'arrayKeyType' => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => NULL, - 'value' => 'COLUMN_NAME', - 'isClassString' => false, - )), - 'value' => 'COLUMN_NAME', - 'isClassString' => false, - )), - 'value' => 'COLUMN_NAME', - 'isClassString' => false, - )), - 4 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => NULL, - 'value' => 'COLUMN_TYPE', - 'isClassString' => false, - )), - 'value' => 'COLUMN_TYPE', - 'isClassString' => false, - )), - 'value' => 'COLUMN_TYPE', - 'isClassString' => false, - )), - 5 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => NULL, - 'value' => 'EXTRA', - 'isClassString' => false, - )), - 'value' => 'EXTRA', - 'isClassString' => false, - )), - 'value' => 'EXTRA', - 'isClassString' => false, - )), - ), - 'normalized' => false, - )), - 'itemType' => - PHPStan\Type\StringType::__set_state(array( - )), - 'allArrays' => NULL, - 'nextAutoIndexes' => - array ( - 0 => 3, - ), - 'keyTypes' => - array ( - 0 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => NULL, - 'value' => 'COLUMN_NAME', - 'isClassString' => false, - )), - 'value' => 'COLUMN_NAME', - 'isClassString' => false, - )), - 'value' => 'COLUMN_NAME', - 'isClassString' => false, - )), - 1 => - PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( - 'value' => 0, - )), - 2 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => NULL, - 'value' => 'EXTRA', - 'isClassString' => false, - )), - 'value' => 'EXTRA', - 'isClassString' => false, - )), - 'value' => 'EXTRA', - 'isClassString' => false, - )), - 3 => - PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( - 'value' => 1, - )), - 4 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => NULL, - 'value' => 'COLUMN_TYPE', - 'isClassString' => false, - )), - 'value' => 'COLUMN_TYPE', - 'isClassString' => false, - )), - '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 ( - ), - 'isList' => false, - )), - ), - ), - 'SELECT - MD5( - GROUP_CONCAT( - CONCAT( - COALESCE(COLUMN_NAME, ""), - COALESCE(EXTRA, ""), - COLUMN_TYPE, - IS_NULLABLE - ) - ) - ) AS dbsignature, - 1 AS grouper - FROM - information_schema.columns - WHERE - table_schema = DATABASE() - GROUP BY - grouper' => - array ( - 'result' => - array ( - 5 => - PHPStan\Type\Constant\ConstantArrayType::__set_state(array( - 'keyType' => - PHPStan\Type\UnionType::__set_state(array( - 'sortedTypes' => true, - 'cachedDescriptions' => - array ( - 2 => '0|1|\'dbsignature\'|\'grouper\'', - 1 => 'int|string', - ), - '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\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => NULL, - 'value' => 'dbsignature', - 'isClassString' => false, - )), - 3 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => NULL, - 'value' => 'grouper', - 'isClassString' => false, - )), - ), - 'normalized' => false, - )), - 'itemType' => - PHPStan\Type\UnionType::__set_state(array( - 'sortedTypes' => true, - 'cachedDescriptions' => - array ( - 1 => 'int|string|null', - ), - 'types' => - array ( - 0 => - PHPStan\Type\IntegerType::__set_state(array( - )), - 1 => - PHPStan\Type\StringType::__set_state(array( - )), - 2 => - PHPStan\Type\NullType::__set_state(array( - )), - ), - 'normalized' => true, - )), - 'allArrays' => NULL, - 'nextAutoIndexes' => - array ( - 0 => 2, - ), - 'keyTypes' => - array ( - 0 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => NULL, - 'value' => 'dbsignature', - 'isClassString' => false, - )), - 1 => - PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( - 'value' => 0, - )), - 2 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => NULL, - 'value' => 'grouper', - 'isClassString' => false, - )), - 3 => - PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( - 'value' => 1, - )), - ), - 'valueTypes' => - array ( - 0 => - PHPStan\Type\UnionType::__set_state(array( - 'sortedTypes' => true, - 'cachedDescriptions' => - array ( - 4 => 'string|null', - 2 => 'string|null', - 3 => 'string|null', - ), - 'types' => - array ( - 0 => - PHPStan\Type\StringType::__set_state(array( - )), - 1 => - PHPStan\Type\NullType::__set_state(array( - )), - ), - 'normalized' => true, - )), - 1 => - PHPStan\Type\UnionType::__set_state(array( - 'sortedTypes' => true, - 'cachedDescriptions' => - array ( - 4 => 'string|null', - 2 => 'string|null', - 3 => 'string|null', - ), - 'types' => - array ( - 0 => - PHPStan\Type\StringType::__set_state(array( - )), - 1 => - PHPStan\Type\NullType::__set_state(array( - )), - ), - 'normalized' => true, - )), - 2 => - PHPStan\Type\IntegerType::__set_state(array( - )), - 3 => - PHPStan\Type\IntegerType::__set_state(array( - )), - ), - 'optionalKeys' => - array ( - ), - 'isList' => false, - )), - 3 => - PHPStan\Type\Constant\ConstantArrayType::__set_state(array( - 'keyType' => - PHPStan\Type\UnionType::__set_state(array( - 'sortedTypes' => true, - 'cachedDescriptions' => - array ( - 2 => '\'dbsignature\'|\'grouper\'', - 1 => 'string', - ), - 'types' => - array ( - 0 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => NULL, - 'value' => 'dbsignature', - 'isClassString' => false, - )), - 1 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => NULL, - 'value' => 'grouper', - 'isClassString' => false, - )), - ), - 'normalized' => false, - )), - 'itemType' => - PHPStan\Type\UnionType::__set_state(array( - 'sortedTypes' => true, - 'cachedDescriptions' => - array ( - 1 => 'int|string|null', - ), - 'types' => - array ( - 0 => - PHPStan\Type\IntegerType::__set_state(array( - )), - 1 => - PHPStan\Type\StringType::__set_state(array( - )), - 2 => - PHPStan\Type\NullType::__set_state(array( - )), - ), - 'normalized' => true, - )), - 'allArrays' => NULL, - 'nextAutoIndexes' => - array ( - 0 => 0, - ), - 'keyTypes' => - array ( - 0 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => NULL, - 'value' => 'dbsignature', - 'isClassString' => false, - )), - 1 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => NULL, - 'value' => 'grouper', - 'isClassString' => false, - )), - ), - 'valueTypes' => - array ( - 0 => - PHPStan\Type\UnionType::__set_state(array( - 'sortedTypes' => true, - 'cachedDescriptions' => - array ( - 4 => 'string|null', - 3 => 'string|null', - ), - 'types' => - array ( - 0 => - PHPStan\Type\StringType::__set_state(array( - )), - 1 => - PHPStan\Type\NullType::__set_state(array( - )), - ), - 'normalized' => true, - )), - 1 => - PHPStan\Type\IntegerType::__set_state(array( - )), - ), - 'optionalKeys' => - array ( - ), - 'isList' => false, - )), - ), - ), 'SELECT CASE WHEN freigabe1u1 > 50 THEN \'big-one\' @@ -4719,213 +4251,6 @@ )), ), ), - 'SELECT column_name, column_default, is_nullable - FROM information_schema.columns - WHERE table_name = \'1970-01-01\'' => - array ( - 'result' => - array ( - 5 => - PHPStan\Type\Constant\ConstantArrayType::__set_state(array( - 'keyType' => - PHPStan\Type\UnionType::__set_state(array( - 'sortedTypes' => true, - 'cachedDescriptions' => - array ( - 2 => '0|1|2|\'COLUMN_DEFAULT\'|\'COLUMN_NAME\'|\'IS_NULLABLE\'', - 1 => 'int|string', - ), - '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( - 'objectType' => NULL, - 'arrayKeyType' => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => NULL, - 'value' => 'COLUMN_DEFAULT', - 'isClassString' => false, - )), - 'value' => 'COLUMN_DEFAULT', - 'isClassString' => false, - )), - 4 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => NULL, - 'value' => 'COLUMN_NAME', - 'isClassString' => false, - )), - 'value' => 'COLUMN_NAME', - 'isClassString' => false, - )), - 5 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => NULL, - 'value' => 'IS_NULLABLE', - 'isClassString' => false, - )), - 'value' => 'IS_NULLABLE', - 'isClassString' => false, - )), - ), - 'normalized' => false, - )), - 'itemType' => - PHPStan\Type\UnionType::__set_state(array( - 'sortedTypes' => true, - 'cachedDescriptions' => - array ( - 1 => 'string|null', - ), - 'types' => - array ( - 0 => - PHPStan\Type\StringType::__set_state(array( - )), - 1 => - PHPStan\Type\NullType::__set_state(array( - )), - ), - 'normalized' => true, - )), - 'allArrays' => NULL, - 'nextAutoIndexes' => - array ( - 0 => 3, - ), - 'keyTypes' => - array ( - 0 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => NULL, - 'value' => 'COLUMN_NAME', - 'isClassString' => false, - )), - 'value' => 'COLUMN_NAME', - 'isClassString' => false, - )), - 1 => - PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( - 'value' => 0, - )), - 2 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => NULL, - 'value' => 'COLUMN_DEFAULT', - 'isClassString' => false, - )), - 'value' => 'COLUMN_DEFAULT', - 'isClassString' => false, - )), - 3 => - PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( - 'value' => 1, - )), - 4 => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => - PHPStan\Type\Constant\ConstantStringType::__set_state(array( - 'objectType' => NULL, - 'arrayKeyType' => NULL, - 'value' => 'IS_NULLABLE', - 'isClassString' => false, - )), - 'value' => 'IS_NULLABLE', - '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\UnionType::__set_state(array( - 'sortedTypes' => true, - 'cachedDescriptions' => - array ( - 4 => 'string|null', - ), - 'types' => - array ( - 0 => - PHPStan\Type\StringType::__set_state(array( - )), - 1 => - PHPStan\Type\NullType::__set_state(array( - )), - ), - 'normalized' => true, - )), - 3 => - PHPStan\Type\UnionType::__set_state(array( - 'sortedTypes' => true, - 'cachedDescriptions' => - array ( - 4 => 'string|null', - ), - 'types' => - array ( - 0 => - PHPStan\Type\StringType::__set_state(array( - )), - 1 => - PHPStan\Type\NullType::__set_state(array( - )), - ), - 'normalized' => true, - )), - 4 => - PHPStan\Type\StringType::__set_state(array( - )), - 5 => - PHPStan\Type\StringType::__set_state(array( - )), - ), - 'optionalKeys' => - array ( - ), - 'isList' => false, - )), - ), - ), 'SELECT column_name, column_default, is_nullable FROM information_schema.columns WHERE table_name = \'1970-01-01\'' => @@ -6015,6 +5340,73 @@ )), ), ), + 'SELECT count(*) as myemail from ada' => + array ( + 'result' => + array ( + 5 => + PHPStan\Type\Constant\ConstantArrayType::__set_state(array( + 'keyType' => + PHPStan\Type\UnionType::__set_state(array( + 'sortedTypes' => true, + 'cachedDescriptions' => + array ( + 2 => '0|\'myemail\'', + ), + 'types' => + array ( + 0 => + PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( + 'value' => 0, + )), + 1 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'objectType' => NULL, + 'arrayKeyType' => NULL, + 'value' => 'myemail', + 'isClassString' => false, + )), + ), + 'normalized' => false, + )), + 'itemType' => + PHPStan\Type\IntegerType::__set_state(array( + )), + 'allArrays' => NULL, + 'nextAutoIndexes' => + array ( + 0 => 1, + ), + 'keyTypes' => + array ( + 0 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'objectType' => NULL, + 'arrayKeyType' => NULL, + 'value' => 'myemail', + 'isClassString' => false, + )), + 1 => + PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( + 'value' => 0, + )), + ), + 'valueTypes' => + array ( + 0 => + PHPStan\Type\IntegerType::__set_state(array( + )), + 1 => + PHPStan\Type\IntegerType::__set_state(array( + )), + ), + 'optionalKeys' => + array ( + ), + 'isList' => false, + )), + ), + ), 'SELECT count(email) as myemail from ada' => array ( 'result' => diff --git a/tests/default/data/sql-ast-narrowing.php b/tests/default/data/sql-ast-narrowing.php index daeea4ada..fd14482b2 100644 --- a/tests/default/data/sql-ast-narrowing.php +++ b/tests/default/data/sql-ast-narrowing.php @@ -9,6 +9,9 @@ class Foo { public function count(PDO $pdo): void { + $stmt = $pdo->query('SELECT count(*) as myemail from ada'); + assertType('PDOStatement, 0: int<0, max>}>', $stmt); + $stmt = $pdo->query('SELECT count(email) as myemail from ada'); assertType('PDOStatement, 0: int<0, max>}>', $stmt); From 9b7285cd8cd440fe08327ec16a70cd3c82f73e1e Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Fri, 17 Feb 2023 17:24:38 +0100 Subject: [PATCH 2/2] record --- .phpstan-dba-mysqli.cache | 219 +++++++++++++++++- .../config/.phpunit-phpstan-dba-mysqli.cache | 67 ++++++ .../.phpunit-phpstan-dba-pdo-mysql.cache | 67 ++++++ 3 files changed, 341 insertions(+), 12 deletions(-) diff --git a/.phpstan-dba-mysqli.cache b/.phpstan-dba-mysqli.cache index d3faea9e0..d8aaabbad 100644 --- a/.phpstan-dba-mysqli.cache +++ b/.phpstan-dba-mysqli.cache @@ -4,11 +4,23 @@ 'records' => array ( 'SELECT - CASE - WHEN freigabe1u1 > 50 THEN \'big-one\' - WHEN freigabe1u1 = 50 THEN \'normal\' - ELSE freigabe1u1 - END as val from ada' => + MD5( + GROUP_CONCAT( + CONCAT( + COALESCE(COLUMN_NAME, ""), + COALESCE(EXTRA, ""), + COLUMN_TYPE, + IS_NULLABLE + ) + ) + ) AS dbsignature, + 1 AS grouper + FROM + information_schema.columns + WHERE + table_schema = DATABASE() + GROUP BY + grouper' => array ( 'result' => array ( @@ -19,7 +31,8 @@ 'sortedTypes' => true, 'cachedDescriptions' => array ( - 2 => '0|\'val\'', + 2 => '0|1|\'dbsignature\'|\'grouper\'', + 1 => 'int|string', ), 'types' => array ( @@ -28,22 +41,51 @@ 'value' => 0, )), 1 => + PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( + 'value' => 1, + )), + 2 => PHPStan\Type\Constant\ConstantStringType::__set_state(array( 'objectType' => NULL, 'arrayKeyType' => NULL, - 'value' => 'val', + 'value' => 'dbsignature', + 'isClassString' => false, + )), + 3 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'objectType' => NULL, + 'arrayKeyType' => NULL, + 'value' => 'grouper', 'isClassString' => false, )), ), 'normalized' => false, )), 'itemType' => - PHPStan\Type\StringType::__set_state(array( + PHPStan\Type\UnionType::__set_state(array( + 'sortedTypes' => true, + 'cachedDescriptions' => + array ( + 1 => 'int|string|null', + ), + 'types' => + array ( + 0 => + PHPStan\Type\IntegerType::__set_state(array( + )), + 1 => + PHPStan\Type\StringType::__set_state(array( + )), + 2 => + PHPStan\Type\NullType::__set_state(array( + )), + ), + 'normalized' => true, )), 'allArrays' => NULL, 'nextAutoIndexes' => array ( - 0 => 1, + 0 => 2, ), 'keyTypes' => array ( @@ -51,21 +93,174 @@ PHPStan\Type\Constant\ConstantStringType::__set_state(array( 'objectType' => NULL, 'arrayKeyType' => NULL, - 'value' => 'val', + 'value' => 'dbsignature', 'isClassString' => false, )), 1 => PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( 'value' => 0, )), + 2 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'objectType' => NULL, + 'arrayKeyType' => NULL, + 'value' => 'grouper', + 'isClassString' => false, + )), + 3 => + PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( + 'value' => 1, + )), ), 'valueTypes' => array ( 0 => - PHPStan\Type\StringType::__set_state(array( + PHPStan\Type\UnionType::__set_state(array( + 'sortedTypes' => true, + 'cachedDescriptions' => + array ( + 4 => 'string|null', + 2 => 'string|null', + 3 => 'string|null', + ), + 'types' => + array ( + 0 => + PHPStan\Type\StringType::__set_state(array( + )), + 1 => + PHPStan\Type\NullType::__set_state(array( + )), + ), + 'normalized' => true, )), 1 => - PHPStan\Type\StringType::__set_state(array( + PHPStan\Type\UnionType::__set_state(array( + 'sortedTypes' => true, + 'cachedDescriptions' => + array ( + 4 => 'string|null', + 2 => 'string|null', + 3 => 'string|null', + ), + 'types' => + array ( + 0 => + PHPStan\Type\StringType::__set_state(array( + )), + 1 => + PHPStan\Type\NullType::__set_state(array( + )), + ), + 'normalized' => true, + )), + 2 => + PHPStan\Type\IntegerType::__set_state(array( + )), + 3 => + PHPStan\Type\IntegerType::__set_state(array( + )), + ), + 'optionalKeys' => + array ( + ), + 'isList' => false, + )), + 3 => + PHPStan\Type\Constant\ConstantArrayType::__set_state(array( + 'keyType' => + PHPStan\Type\UnionType::__set_state(array( + 'sortedTypes' => true, + 'cachedDescriptions' => + array ( + 2 => '\'dbsignature\'|\'grouper\'', + 1 => 'string', + ), + 'types' => + array ( + 0 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'objectType' => NULL, + 'arrayKeyType' => NULL, + 'value' => 'dbsignature', + 'isClassString' => false, + )), + 1 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'objectType' => NULL, + 'arrayKeyType' => NULL, + 'value' => 'grouper', + 'isClassString' => false, + )), + ), + 'normalized' => false, + )), + 'itemType' => + PHPStan\Type\UnionType::__set_state(array( + 'sortedTypes' => true, + 'cachedDescriptions' => + array ( + 1 => 'int|string|null', + ), + 'types' => + array ( + 0 => + PHPStan\Type\IntegerType::__set_state(array( + )), + 1 => + PHPStan\Type\StringType::__set_state(array( + )), + 2 => + PHPStan\Type\NullType::__set_state(array( + )), + ), + 'normalized' => true, + )), + 'allArrays' => NULL, + 'nextAutoIndexes' => + array ( + 0 => 0, + ), + 'keyTypes' => + array ( + 0 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'objectType' => NULL, + 'arrayKeyType' => NULL, + 'value' => 'dbsignature', + 'isClassString' => false, + )), + 1 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'objectType' => NULL, + 'arrayKeyType' => NULL, + 'value' => 'grouper', + 'isClassString' => false, + )), + ), + 'valueTypes' => + array ( + 0 => + PHPStan\Type\UnionType::__set_state(array( + 'sortedTypes' => true, + 'cachedDescriptions' => + array ( + 4 => 'string|null', + 3 => 'string|null', + ), + 'types' => + array ( + 0 => + PHPStan\Type\StringType::__set_state(array( + )), + 1 => + PHPStan\Type\NullType::__set_state(array( + )), + ), + 'normalized' => true, + )), + 1 => + PHPStan\Type\IntegerType::__set_state(array( )), ), 'optionalKeys' => diff --git a/tests/default/config/.phpunit-phpstan-dba-mysqli.cache b/tests/default/config/.phpunit-phpstan-dba-mysqli.cache index 8e6d1199b..19d2e0704 100644 --- a/tests/default/config/.phpunit-phpstan-dba-mysqli.cache +++ b/tests/default/config/.phpunit-phpstan-dba-mysqli.cache @@ -9101,6 +9101,73 @@ FROM ada' => )), ), ), + 'SELECT count(*) as myemail from ada' => + array ( + 'result' => + array ( + 5 => + PHPStan\Type\Constant\ConstantArrayType::__set_state(array( + 'keyType' => + PHPStan\Type\UnionType::__set_state(array( + 'sortedTypes' => true, + 'cachedDescriptions' => + array ( + 2 => '0|\'myemail\'', + ), + 'types' => + array ( + 0 => + PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( + 'value' => 0, + )), + 1 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'objectType' => NULL, + 'arrayKeyType' => NULL, + 'value' => 'myemail', + 'isClassString' => false, + )), + ), + 'normalized' => false, + )), + 'itemType' => + PHPStan\Type\IntegerType::__set_state(array( + )), + 'allArrays' => NULL, + 'nextAutoIndexes' => + array ( + 0 => 1, + ), + 'keyTypes' => + array ( + 0 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'objectType' => NULL, + 'arrayKeyType' => NULL, + 'value' => 'myemail', + 'isClassString' => false, + )), + 1 => + PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( + 'value' => 0, + )), + ), + 'valueTypes' => + array ( + 0 => + PHPStan\Type\IntegerType::__set_state(array( + )), + 1 => + PHPStan\Type\IntegerType::__set_state(array( + )), + ), + 'optionalKeys' => + array ( + ), + 'isList' => false, + )), + ), + ), 'SELECT count(email) as myemail from ada' => array ( 'result' => diff --git a/tests/default/config/.phpunit-phpstan-dba-pdo-mysql.cache b/tests/default/config/.phpunit-phpstan-dba-pdo-mysql.cache index 6f39545d9..0ff658557 100644 --- a/tests/default/config/.phpunit-phpstan-dba-pdo-mysql.cache +++ b/tests/default/config/.phpunit-phpstan-dba-pdo-mysql.cache @@ -8399,6 +8399,73 @@ FROM ada' => )), ), ), + 'SELECT count(*) as myemail from ada' => + array ( + 'result' => + array ( + 5 => + PHPStan\Type\Constant\ConstantArrayType::__set_state(array( + 'keyType' => + PHPStan\Type\UnionType::__set_state(array( + 'sortedTypes' => true, + 'cachedDescriptions' => + array ( + 2 => '0|\'myemail\'', + ), + 'types' => + array ( + 0 => + PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( + 'value' => 0, + )), + 1 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'objectType' => NULL, + 'arrayKeyType' => NULL, + 'value' => 'myemail', + 'isClassString' => false, + )), + ), + 'normalized' => false, + )), + 'itemType' => + PHPStan\Type\IntegerType::__set_state(array( + )), + 'allArrays' => NULL, + 'nextAutoIndexes' => + array ( + 0 => 1, + ), + 'keyTypes' => + array ( + 0 => + PHPStan\Type\Constant\ConstantStringType::__set_state(array( + 'objectType' => NULL, + 'arrayKeyType' => NULL, + 'value' => 'myemail', + 'isClassString' => false, + )), + 1 => + PHPStan\Type\Constant\ConstantIntegerType::__set_state(array( + 'value' => 0, + )), + ), + 'valueTypes' => + array ( + 0 => + PHPStan\Type\IntegerType::__set_state(array( + )), + 1 => + PHPStan\Type\IntegerType::__set_state(array( + )), + ), + 'optionalKeys' => + array ( + ), + 'isList' => false, + )), + ), + ), 'SELECT count(email) as myemail from ada' => array ( 'result' =>