diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml
index 564ac258d..e3fee5e55 100644
--- a/.github/workflows/phpstan.yml
+++ b/.github/workflows/phpstan.yml
@@ -19,18 +19,29 @@ jobs:
- php-version: "8.0"
db-image: 'mysql:8.0'
reflector: "pdo"
+ mode: "recording"
- php-version: "8.0"
db-image: 'mysql:8.0'
reflector: "mysqli"
+ mode: "recording"
+
- php-version: "8.1"
db-image: 'mysql:8.0'
reflector: "mysqli"
+ mode: "recording"
- php-version: '8.1'
db-image: 'mariadb:latest'
reflector: "mysqli"
+ mode: "recording"
+
+ - php-version: "8.1"
+ db-image: 'mysql:8.0'
+ reflector: "mysqli"
+ mode: "replay-and-recording"
env:
DBA_REFLECTOR: ${{ matrix.reflector }}
+ DBA_MODE: ${{ matrix.mode }}
# https://docs.github.com/en/free-pro-team@latest/actions/guides/about-service-containers
services:
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 824f61eea..6158ab941 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -19,18 +19,29 @@ jobs:
- php-version: "8.0"
db-image: 'mysql:8.0'
reflector: "pdo"
+ mode: "recording"
- php-version: "8.0"
db-image: 'mysql:8.0'
reflector: "mysqli"
+ mode: "recording"
+
- php-version: "8.1"
db-image: 'mysql:8.0'
reflector: "mysqli"
+ mode: "recording"
- php-version: '8.1'
db-image: 'mariadb:latest'
reflector: "mysqli"
+ mode: "recording"
+
+ - php-version: "8.1"
+ db-image: 'mysql:8.0'
+ reflector: "pdo"
+ mode: "replay-and-recording"
env:
DBA_REFLECTOR: ${{ matrix.reflector }}
+ DBA_MODE: ${{ matrix.mode }}
# https://docs.github.com/en/free-pro-team@latest/actions/guides/about-service-containers
services:
diff --git a/.phpstan-dba-mysqli.cache b/.phpstan-dba-mysqli.cache
index 2e18e8a6d..ff8d0e56a 100644
--- a/.phpstan-dba-mysqli.cache
+++ b/.phpstan-dba-mysqli.cache
@@ -1,13 +1,27 @@
'v5-runtime-config-bugfix',
+ 'schemaVersion' => 'v6-schema-hash',
+ 'schemaHash' => '134ec79b27e531b457d91e12a24830db',
'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()' =>
+ '
+ 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 (
@@ -18,7 +32,7 @@
array (
0 =>
PHPStan\Type\Constant\ConstantStringType::__set_state(array(
- 'value' => 'COLUMN_NAME',
+ 'value' => 'dbsignature',
'isClassString' => false,
)),
1 =>
@@ -27,45 +41,48 @@
)),
2 =>
PHPStan\Type\Constant\ConstantStringType::__set_state(array(
- 'value' => 'EXTRA',
+ 'value' => 'grouper',
'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(
+ PHPStan\Type\UnionType::__set_state(array(
+ 'types' =>
+ array (
+ 0 =>
+ PHPStan\Type\StringType::__set_state(array(
+ )),
+ 1 =>
+ PHPStan\Type\NullType::__set_state(array(
+ )),
+ ),
)),
1 =>
- PHPStan\Type\StringType::__set_state(array(
+ PHPStan\Type\UnionType::__set_state(array(
+ 'types' =>
+ array (
+ 0 =>
+ PHPStan\Type\StringType::__set_state(array(
+ )),
+ 1 =>
+ PHPStan\Type\NullType::__set_state(array(
+ )),
+ ),
)),
2 =>
- PHPStan\Type\StringType::__set_state(array(
+ PHPStan\Type\IntegerType::__set_state(array(
)),
3 =>
- PHPStan\Type\StringType::__set_state(array(
- )),
- 4 =>
- PHPStan\Type\StringType::__set_state(array(
- )),
- 5 =>
- PHPStan\Type\StringType::__set_state(array(
+ PHPStan\Type\IntegerType::__set_state(array(
)),
),
- 'nextAutoIndex' => 3,
+ 'nextAutoIndex' => 2,
'optionalKeys' =>
array (
),
@@ -82,44 +99,105 @@
'value' => 1,
)),
2 =>
- PHPStan\Type\Constant\ConstantIntegerType::__set_state(array(
- 'value' => 2,
+ PHPStan\Type\Constant\ConstantStringType::__set_state(array(
+ 'value' => 'dbsignature',
+ 'isClassString' => false,
)),
3 =>
PHPStan\Type\Constant\ConstantStringType::__set_state(array(
- 'value' => 'COLUMN_NAME',
+ 'value' => 'grouper',
'isClassString' => false,
)),
- 4 =>
+ ),
+ )),
+ 'itemType' =>
+ PHPStan\Type\UnionType::__set_state(array(
+ 'types' =>
+ array (
+ 0 =>
+ PHPStan\Type\IntegerType::__set_state(array(
+ )),
+ 1 =>
+ PHPStan\Type\StringType::__set_state(array(
+ )),
+ 2 =>
+ PHPStan\Type\NullType::__set_state(array(
+ )),
+ ),
+ )),
+ )),
+ 3 =>
+ PHPStan\Type\Constant\ConstantArrayType::__set_state(array(
+ 'allArrays' => NULL,
+ 'keyTypes' =>
+ array (
+ 0 =>
+ PHPStan\Type\Constant\ConstantStringType::__set_state(array(
+ 'value' => 'dbsignature',
+ 'isClassString' => false,
+ )),
+ 1 =>
+ PHPStan\Type\Constant\ConstantStringType::__set_state(array(
+ 'value' => 'grouper',
+ 'isClassString' => false,
+ )),
+ ),
+ 'valueTypes' =>
+ array (
+ 0 =>
+ PHPStan\Type\UnionType::__set_state(array(
+ 'types' =>
+ array (
+ 0 =>
+ PHPStan\Type\StringType::__set_state(array(
+ )),
+ 1 =>
+ PHPStan\Type\NullType::__set_state(array(
+ )),
+ ),
+ )),
+ 1 =>
+ PHPStan\Type\IntegerType::__set_state(array(
+ )),
+ ),
+ 'nextAutoIndex' => 0,
+ 'optionalKeys' =>
+ array (
+ ),
+ 'keyType' =>
+ PHPStan\Type\UnionType::__set_state(array(
+ 'types' =>
+ array (
+ 0 =>
PHPStan\Type\Constant\ConstantStringType::__set_state(array(
- 'value' => 'COLUMN_TYPE',
+ 'value' => 'dbsignature',
'isClassString' => false,
)),
- 5 =>
+ 1 =>
PHPStan\Type\Constant\ConstantStringType::__set_state(array(
- 'value' => 'EXTRA',
+ 'value' => 'grouper',
'isClassString' => false,
)),
),
)),
'itemType' =>
- PHPStan\Type\StringType::__set_state(array(
+ PHPStan\Type\UnionType::__set_state(array(
+ 'types' =>
+ array (
+ 0 =>
+ PHPStan\Type\IntegerType::__set_state(array(
+ )),
+ 1 =>
+ PHPStan\Type\StringType::__set_state(array(
+ )),
+ 2 =>
+ PHPStan\Type\NullType::__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
coalesce(COLUMN_NAME, "") as COLUMN_NAME,
coalesce(EXTRA, "") as EXTRA,
@@ -1585,7 +1663,7 @@
)),
),
),
- 'SELECT a.email, b.adaid, b.gesperrt FROM ada a LEFT JOIN ada b ON a.adaid=b.adaid' =>
+ 'SELECT adaid FROM ada LIMIT 1 FOR SHARE' =>
array (
'result' =>
array (
@@ -1596,246 +1674,28 @@
array (
0 =>
PHPStan\Type\Constant\ConstantStringType::__set_state(array(
- 'value' => 'email',
+ 'value' => 'adaid',
'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,
- )),
),
'valueTypes' =>
array (
0 =>
- PHPStan\Type\StringType::__set_state(array(
+ PHPStan\Type\IntegerRangeType::__set_state(array(
+ 'min' => 0,
+ 'max' => 4294967295,
)),
1 =>
- PHPStan\Type\StringType::__set_state(array(
- )),
- 2 =>
- PHPStan\Type\UnionType::__set_state(array(
- 'types' =>
- array (
- 0 =>
- PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => 0,
- 'max' => 4294967295,
- )),
- 1 =>
- PHPStan\Type\NullType::__set_state(array(
- )),
- ),
- )),
- 3 =>
- PHPStan\Type\UnionType::__set_state(array(
- 'types' =>
- array (
- 0 =>
- PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => 0,
- 'max' => 4294967295,
- )),
- 1 =>
- PHPStan\Type\NullType::__set_state(array(
- )),
- ),
- )),
- 4 =>
- PHPStan\Type\UnionType::__set_state(array(
- 'types' =>
- array (
- 0 =>
- PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => -128,
- 'max' => 127,
- )),
- 1 =>
- PHPStan\Type\NullType::__set_state(array(
- )),
- ),
- )),
- 5 =>
- PHPStan\Type\UnionType::__set_state(array(
- 'types' =>
- array (
- 0 =>
- PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => -128,
- 'max' => 127,
- )),
- 1 =>
- PHPStan\Type\NullType::__set_state(array(
- )),
- ),
+ PHPStan\Type\IntegerRangeType::__set_state(array(
+ 'min' => 0,
+ 'max' => 4294967295,
)),
),
- 'nextAutoIndex' => 3,
- 'optionalKeys' =>
- 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\ConstantStringType::__set_state(array(
- 'value' => 'adaid',
- 'isClassString' => false,
- )),
- 4 =>
- PHPStan\Type\Constant\ConstantStringType::__set_state(array(
- 'value' => 'email',
- 'isClassString' => false,
- )),
- 5 =>
- 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(
- )),
- 2 =>
- PHPStan\Type\NullType::__set_state(array(
- )),
- ),
- )),
- )),
- ),
- ),
- 'SELECT adaid FROM ada' =>
- array (
- 'result' =>
- array (
- 5 =>
- PHPStan\Type\Constant\ConstantArrayType::__set_state(array(
- '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 (
- ),
- '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,
- )),
- )),
- ),
- ),
- 'SELECT adaid FROM ada LIMIT 1 FOR SHARE' =>
- array (
- 'result' =>
- array (
- 5 =>
- PHPStan\Type\Constant\ConstantArrayType::__set_state(array(
- '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,
+ 'nextAutoIndex' => 1,
'optionalKeys' =>
array (
),
@@ -1980,66 +1840,7 @@
)),
),
),
- 'SELECT adaid FROM ada WHERE adaid IN (\'1\')' =>
- array (
- 'result' =>
- array (
- 5 =>
- PHPStan\Type\Constant\ConstantArrayType::__set_state(array(
- '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 (
- ),
- '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,
- )),
- )),
- ),
- ),
- 'SELECT adaid FROM ada WHERE adaid IN (\'1\') AND email LIKE \'1970-01-01\'' =>
+ 'SELECT adaid FROM ada WHERE email LIKE ":gesperrt%"' =>
array (
'result' =>
array (
@@ -2098,7 +1899,7 @@
)),
),
),
- 'SELECT adaid FROM ada WHERE adaid IN (\'1.0\')' =>
+ 'SELECT adaid FROM ada WHERE email LIKE "hello?%"' =>
array (
'result' =>
array (
@@ -2157,28 +1958,7 @@
)),
),
),
- 'SELECT adaid FROM ada WHERE adaid IN (:adaids)' =>
- array (
- 'result' =>
- array (
- 5 => NULL,
- ),
- ),
- 'SELECT adaid FROM ada WHERE adaid IN (:ids)' =>
- array (
- 'result' =>
- array (
- 5 => NULL,
- ),
- ),
- 'SELECT adaid FROM ada WHERE adaid IN (:ids) AND email LIKE :time' =>
- array (
- 'result' =>
- array (
- 5 => NULL,
- ),
- ),
- 'SELECT adaid FROM ada WHERE adaid IN (NULL) AND email LIKE \'1970-01-01\'' =>
+ 'SELECT adaid FROM ada WHERE email LIKE \'%questions ?%\'' =>
array (
'result' =>
array (
@@ -2237,7 +2017,7 @@
)),
),
),
- 'SELECT adaid FROM ada WHERE email LIKE ":gesperrt%"' =>
+ 'SELECT adaid FROM ada WHERE email LIKE \':gesperrt%\'' =>
array (
'result' =>
array (
@@ -2296,7 +2076,7 @@
)),
),
),
- 'SELECT adaid FROM ada WHERE email LIKE "hello?%"' =>
+ 'SELECT akid FROM ak WHERE eadavk>1.0' =>
array (
'result' =>
array (
@@ -2307,7 +2087,7 @@
array (
0 =>
PHPStan\Type\Constant\ConstantStringType::__set_state(array(
- 'value' => 'adaid',
+ 'value' => 'akid',
'isClassString' => false,
)),
1 =>
@@ -2319,13 +2099,13 @@
array (
0 =>
PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => 0,
- 'max' => 4294967295,
+ 'min' => -2147483648,
+ 'max' => 2147483647,
)),
1 =>
PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => 0,
- 'max' => 4294967295,
+ 'min' => -2147483648,
+ 'max' => 2147483647,
)),
),
'nextAutoIndex' => 1,
@@ -2342,20 +2122,20 @@
)),
1 =>
PHPStan\Type\Constant\ConstantStringType::__set_state(array(
- 'value' => 'adaid',
+ 'value' => 'akid',
'isClassString' => false,
)),
),
)),
'itemType' =>
PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => 0,
- 'max' => 4294967295,
+ 'min' => -2147483648,
+ 'max' => 2147483647,
)),
)),
),
),
- 'SELECT adaid FROM ada WHERE email LIKE \'%questions ?%\'' =>
+ 'SELECT akid FROM ak WHERE eadavk>1.1' =>
array (
'result' =>
array (
@@ -2366,913 +2146,28 @@
array (
0 =>
PHPStan\Type\Constant\ConstantStringType::__set_state(array(
- 'value' => 'adaid',
+ 'value' => 'akid',
'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 (
- ),
- '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,
- )),
- )),
- ),
- ),
- 'SELECT adaid FROM ada WHERE email LIKE \':gesperrt%\'' =>
- array (
- 'result' =>
- array (
- 5 =>
- PHPStan\Type\Constant\ConstantArrayType::__set_state(array(
- '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 (
- ),
- '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,
- )),
- )),
- ),
- ),
- 'SELECT akid FROM ak WHERE eadavk>1.0' =>
- array (
- 'result' =>
- array (
- 5 =>
- PHPStan\Type\Constant\ConstantArrayType::__set_state(array(
- 'allArrays' => NULL,
- 'keyTypes' =>
- array (
- 0 =>
- PHPStan\Type\Constant\ConstantStringType::__set_state(array(
- 'value' => 'akid',
- 'isClassString' => false,
- )),
- 1 =>
- PHPStan\Type\Constant\ConstantIntegerType::__set_state(array(
- 'value' => 0,
- )),
- ),
- 'valueTypes' =>
- array (
- 0 =>
- PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => -2147483648,
- 'max' => 2147483647,
- )),
- 1 =>
- PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => -2147483648,
- 'max' => 2147483647,
- )),
- ),
- 'nextAutoIndex' => 1,
- 'optionalKeys' =>
- 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' => 'akid',
- 'isClassString' => false,
- )),
- ),
- )),
- 'itemType' =>
- PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => -2147483648,
- 'max' => 2147483647,
- )),
- )),
- ),
- ),
- 'SELECT akid FROM ak WHERE eadavk>1.1' =>
- array (
- 'result' =>
- array (
- 5 =>
- PHPStan\Type\Constant\ConstantArrayType::__set_state(array(
- 'allArrays' => NULL,
- 'keyTypes' =>
- array (
- 0 =>
- PHPStan\Type\Constant\ConstantStringType::__set_state(array(
- 'value' => 'akid',
- 'isClassString' => false,
- )),
- 1 =>
- PHPStan\Type\Constant\ConstantIntegerType::__set_state(array(
- 'value' => 0,
- )),
- ),
- 'valueTypes' =>
- array (
- 0 =>
- PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => -2147483648,
- 'max' => 2147483647,
- )),
- 1 =>
- PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => -2147483648,
- 'max' => 2147483647,
- )),
- ),
- 'nextAutoIndex' => 1,
- 'optionalKeys' =>
- 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' => 'akid',
- 'isClassString' => false,
- )),
- ),
- )),
- 'itemType' =>
- PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => -2147483648,
- 'max' => 2147483647,
- )),
- )),
- ),
- ),
- 'SELECT count(*) FROM typemix WHERE c_date = \'1970-01-01\'' =>
- array (
- 'result' =>
- array (
- 5 =>
- PHPStan\Type\Constant\ConstantArrayType::__set_state(array(
- 'allArrays' => NULL,
- 'keyTypes' =>
- array (
- 0 =>
- PHPStan\Type\Constant\ConstantStringType::__set_state(array(
- 'value' => 'count(*)',
- '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(
- )),
- ),
- 'nextAutoIndex' => 1,
- 'optionalKeys' =>
- 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' => 'count(*)',
- 'isClassString' => false,
- )),
- ),
- )),
- 'itemType' =>
- PHPStan\Type\IntegerType::__set_state(array(
- )),
- )),
- ),
- ),
- 'SELECT count(*) FROM typemix WHERE c_datetime = \'1970-01-01\'' =>
- array (
- 'result' =>
- array (
- 5 =>
- PHPStan\Type\Constant\ConstantArrayType::__set_state(array(
- 'allArrays' => NULL,
- 'keyTypes' =>
- array (
- 0 =>
- PHPStan\Type\Constant\ConstantStringType::__set_state(array(
- 'value' => 'count(*)',
- '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(
- )),
- ),
- 'nextAutoIndex' => 1,
- 'optionalKeys' =>
- 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' => 'count(*)',
- 'isClassString' => false,
- )),
- ),
- )),
- 'itemType' =>
- PHPStan\Type\IntegerType::__set_state(array(
- )),
- )),
- ),
- ),
- 'SELECT eladaid FROM ak' =>
- array (
- 'result' =>
- array (
- 5 =>
- PHPStan\Type\Constant\ConstantArrayType::__set_state(array(
- 'allArrays' => NULL,
- 'keyTypes' =>
- array (
- 0 =>
- PHPStan\Type\Constant\ConstantStringType::__set_state(array(
- 'value' => 'eladaid',
- 'isClassString' => false,
- )),
- 1 =>
- PHPStan\Type\Constant\ConstantIntegerType::__set_state(array(
- 'value' => 0,
- )),
- ),
- 'valueTypes' =>
- array (
- 0 =>
- PHPStan\Type\UnionType::__set_state(array(
- 'types' =>
- array (
- 0 =>
- PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => -2147483648,
- 'max' => 2147483647,
- )),
- 1 =>
- PHPStan\Type\NullType::__set_state(array(
- )),
- ),
- )),
- 1 =>
- PHPStan\Type\UnionType::__set_state(array(
- 'types' =>
- array (
- 0 =>
- PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => -2147483648,
- 'max' => 2147483647,
- )),
- 1 =>
- PHPStan\Type\NullType::__set_state(array(
- )),
- ),
- )),
- ),
- 'nextAutoIndex' => 1,
- 'optionalKeys' =>
- 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' => 'eladaid',
- 'isClassString' => false,
- )),
- ),
- )),
- 'itemType' =>
- PHPStan\Type\UnionType::__set_state(array(
- 'types' =>
- array (
- 0 =>
- PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => -2147483648,
- 'max' => 2147483647,
- )),
- 1 =>
- PHPStan\Type\NullType::__set_state(array(
- )),
- ),
- )),
- )),
- ),
- ),
- 'SELECT email FROM ada' =>
- array (
- 'result' =>
- array (
- 5 =>
- PHPStan\Type\Constant\ConstantArrayType::__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,
- )),
- ),
- 'valueTypes' =>
- array (
- 0 =>
- PHPStan\Type\StringType::__set_state(array(
- )),
- 1 =>
- PHPStan\Type\StringType::__set_state(array(
- )),
- ),
- 'nextAutoIndex' => 1,
- 'optionalKeys' =>
- 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' => 'email',
- 'isClassString' => false,
- )),
- ),
- )),
- 'itemType' =>
- PHPStan\Type\StringType::__set_state(array(
- )),
- )),
- ),
- ),
- 'SELECT email adaid WHERE gesperrt freigabe1u1 FROM ada' =>
- array (
- 'result' =>
- array (
- 5 => NULL,
- ),
- ),
- 'SELECT email, adaid FROM ada' =>
- array (
- 'result' =>
- array (
- 5 =>
- PHPStan\Type\Constant\ConstantArrayType::__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,
- )),
- ),
- '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,
- )),
- ),
- 'nextAutoIndex' => 2,
- 'optionalKeys' =>
- 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\ConstantStringType::__set_state(array(
- 'value' => 'adaid',
- 'isClassString' => false,
- )),
- 3 =>
- PHPStan\Type\Constant\ConstantStringType::__set_state(array(
- 'value' => 'email',
- 'isClassString' => false,
- )),
- ),
- )),
- 'itemType' =>
- PHPStan\Type\UnionType::__set_state(array(
- 'types' =>
- array (
- 0 =>
- PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => 0,
- 'max' => 4294967295,
- )),
- 1 =>
- PHPStan\Type\StringType::__set_state(array(
- )),
- ),
- )),
- )),
- ),
- ),
- 'SELECT email, adaid FROM ada WHERE adaid = \'1\'' =>
- array (
- 'result' =>
- array (
- 5 =>
- PHPStan\Type\Constant\ConstantArrayType::__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,
- )),
- ),
- '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,
- )),
- ),
- 'nextAutoIndex' => 2,
- 'optionalKeys' =>
- 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\ConstantStringType::__set_state(array(
- 'value' => 'adaid',
- 'isClassString' => false,
- )),
- 3 =>
- PHPStan\Type\Constant\ConstantStringType::__set_state(array(
- 'value' => 'email',
- 'isClassString' => false,
- )),
- ),
- )),
- 'itemType' =>
- PHPStan\Type\UnionType::__set_state(array(
- 'types' =>
- array (
- 0 =>
- PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => 0,
- 'max' => 4294967295,
- )),
- 1 =>
- PHPStan\Type\StringType::__set_state(array(
- )),
- ),
- )),
- )),
- ),
- ),
- 'SELECT email, adaid FROM ada WHERE adaid = ?' =>
- array (
- 'result' =>
- array (
- 5 => NULL,
- ),
- ),
- 'SELECT email, adaid FROM ada WHERE adaid=1' =>
- array (
- 'result' =>
- array (
- 5 =>
- PHPStan\Type\Constant\ConstantArrayType::__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,
- )),
- ),
- '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,
- )),
- ),
- 'nextAutoIndex' => 2,
- 'optionalKeys' =>
- 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\ConstantStringType::__set_state(array(
- 'value' => 'adaid',
- 'isClassString' => false,
- )),
- 3 =>
- PHPStan\Type\Constant\ConstantStringType::__set_state(array(
- 'value' => 'email',
- 'isClassString' => false,
- )),
- ),
- )),
- 'itemType' =>
- PHPStan\Type\UnionType::__set_state(array(
- 'types' =>
- array (
- 0 =>
- PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => 0,
- 'max' => 4294967295,
- )),
- 1 =>
- PHPStan\Type\StringType::__set_state(array(
- )),
- ),
- )),
- )),
- ),
- ),
- 'SELECT email, adaid FROM ada WHERE email = \'test@example.org\'' =>
- array (
- 'result' =>
- array (
- 5 =>
- PHPStan\Type\Constant\ConstantArrayType::__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,
- )),
- ),
- '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,
- )),
- ),
- 'nextAutoIndex' => 2,
- 'optionalKeys' =>
- 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\ConstantStringType::__set_state(array(
- 'value' => 'adaid',
- 'isClassString' => false,
- )),
- 3 =>
- PHPStan\Type\Constant\ConstantStringType::__set_state(array(
- 'value' => 'email',
- 'isClassString' => false,
- )),
- ),
- )),
- 'itemType' =>
- PHPStan\Type\UnionType::__set_state(array(
- 'types' =>
- array (
- 0 =>
- PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => 0,
- 'max' => 4294967295,
- )),
- 1 =>
- PHPStan\Type\StringType::__set_state(array(
- )),
- ),
- )),
- )),
- ),
- ),
- 'SELECT email, adaid FROM ada WHERE email = ?' =>
- array (
- 'result' =>
- array (
- 5 => NULL,
- ),
- ),
- 'SELECT email, adaid FROM ada WHERE email=\'test@example.org\'' =>
- array (
- 'result' =>
- array (
- 5 =>
- PHPStan\Type\Constant\ConstantArrayType::__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,
+ 'value' => 0,
)),
),
'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,
+ 'min' => -2147483648,
+ 'max' => 2147483647,
)),
- 3 =>
+ 1 =>
PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => 0,
- 'max' => 4294967295,
+ 'min' => -2147483648,
+ 'max' => 2147483647,
)),
),
- 'nextAutoIndex' => 2,
+ 'nextAutoIndex' => 1,
'optionalKeys' =>
array (
),
@@ -3285,39 +2180,21 @@
'value' => 0,
)),
1 =>
- PHPStan\Type\Constant\ConstantIntegerType::__set_state(array(
- 'value' => 1,
- )),
- 2 =>
- PHPStan\Type\Constant\ConstantStringType::__set_state(array(
- 'value' => 'adaid',
- 'isClassString' => false,
- )),
- 3 =>
PHPStan\Type\Constant\ConstantStringType::__set_state(array(
- 'value' => 'email',
+ 'value' => 'akid',
'isClassString' => false,
)),
),
)),
'itemType' =>
- PHPStan\Type\UnionType::__set_state(array(
- 'types' =>
- array (
- 0 =>
- PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => 0,
- 'max' => 4294967295,
- )),
- 1 =>
- PHPStan\Type\StringType::__set_state(array(
- )),
- ),
+ PHPStan\Type\IntegerRangeType::__set_state(array(
+ 'min' => -2147483648,
+ 'max' => 2147483647,
)),
)),
),
),
- 'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada' =>
+ 'SELECT eladaid FROM ak' =>
array (
'result' =>
array (
@@ -3328,81 +2205,46 @@
array (
0 =>
PHPStan\Type\Constant\ConstantStringType::__set_state(array(
- 'value' => 'email',
+ 'value' => 'eladaid',
'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(
+ PHPStan\Type\UnionType::__set_state(array(
+ 'types' =>
+ array (
+ 0 =>
+ PHPStan\Type\IntegerRangeType::__set_state(array(
+ 'min' => -2147483648,
+ 'max' => 2147483647,
+ )),
+ 1 =>
+ PHPStan\Type\NullType::__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,
+ PHPStan\Type\UnionType::__set_state(array(
+ 'types' =>
+ array (
+ 0 =>
+ PHPStan\Type\IntegerRangeType::__set_state(array(
+ 'min' => -2147483648,
+ 'max' => 2147483647,
+ )),
+ 1 =>
+ PHPStan\Type\NullType::__set_state(array(
+ )),
+ ),
)),
),
- 'nextAutoIndex' => 4,
+ 'nextAutoIndex' => 1,
'optionalKeys' =>
array (
),
@@ -3415,35 +2257,8 @@
'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',
+ 'value' => 'eladaid',
'isClassString' => false,
)),
),
@@ -3454,18 +2269,25 @@
array (
0 =>
PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => -128,
- 'max' => 4294967295,
+ 'min' => -2147483648,
+ 'max' => 2147483647,
)),
1 =>
- PHPStan\Type\StringType::__set_state(array(
+ PHPStan\Type\NullType::__set_state(array(
)),
),
)),
)),
),
),
- 'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada LIMIT 1' =>
+ 'SELECT email adaid WHERE gesperrt freigabe1u1 FROM ada' =>
+ array (
+ 'result' =>
+ array (
+ 5 => NULL,
+ ),
+ ),
+ 'SELECT email, adaid FROM ada' =>
array (
'result' =>
array (
@@ -3492,24 +2314,6 @@
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 (
@@ -3529,28 +2333,8 @@
'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,
+ 'nextAutoIndex' => 2,
'optionalKeys' =>
array (
),
@@ -3567,33 +2351,15 @@
'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 =>
+ 3 =>
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' =>
@@ -3602,7 +2368,7 @@
array (
0 =>
PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => -128,
+ 'min' => 0,
'max' => 4294967295,
)),
1 =>
@@ -3613,7 +2379,7 @@
)),
),
),
- 'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada LIMIT 1, 10' =>
+ 'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada' =>
array (
'result' =>
array (
@@ -3761,7 +2527,7 @@
)),
),
),
- 'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada WHERE adaid = \'1\'' =>
+ 'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada LIMIT 1' =>
array (
'result' =>
array (
@@ -3909,7 +2675,7 @@
)),
),
),
- 'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada WHERE adaid = 1' =>
+ 'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada LIMIT 1, 10' =>
array (
'result' =>
array (
@@ -4057,14 +2823,7 @@
)),
),
),
- 'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada WHERE adaid = ?' =>
- array (
- 'result' =>
- array (
- 5 => NULL,
- ),
- ),
- 'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada WHERE adaid IN(1,3)' =>
+ 'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada WHERE adaid = 1' =>
array (
'result' =>
array (
@@ -4212,7 +2971,7 @@
)),
),
),
- 'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada WHERE adaid=1' =>
+ 'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada WHERE adaid IN(1,3)' =>
array (
'result' =>
array (
@@ -4360,7 +3119,7 @@
)),
),
),
- 'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada WHERE email = \'1970-01-01\'' =>
+ 'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada WHERE adaid=1' =>
array (
'result' =>
array (
diff --git a/.phpstan-dba-pdo.cache b/.phpstan-dba-pdo.cache
index da3c67239..aa4bde890 100644
--- a/.phpstan-dba-pdo.cache
+++ b/.phpstan-dba-pdo.cache
@@ -1,13 +1,27 @@
'v5-runtime-config-bugfix',
+ 'schemaVersion' => 'v6-schema-hash',
+ 'schemaHash' => NULL,
'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()' =>
+ '
+ 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 (
@@ -18,7 +32,7 @@
array (
0 =>
PHPStan\Type\Constant\ConstantStringType::__set_state(array(
- 'value' => 'COLUMN_NAME',
+ 'value' => 'dbsignature',
'isClassString' => false,
)),
1 =>
@@ -27,45 +41,48 @@
)),
2 =>
PHPStan\Type\Constant\ConstantStringType::__set_state(array(
- 'value' => 'EXTRA',
+ 'value' => 'grouper',
'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(
+ PHPStan\Type\UnionType::__set_state(array(
+ 'types' =>
+ array (
+ 0 =>
+ PHPStan\Type\StringType::__set_state(array(
+ )),
+ 1 =>
+ PHPStan\Type\NullType::__set_state(array(
+ )),
+ ),
)),
1 =>
- PHPStan\Type\StringType::__set_state(array(
+ PHPStan\Type\UnionType::__set_state(array(
+ 'types' =>
+ array (
+ 0 =>
+ PHPStan\Type\StringType::__set_state(array(
+ )),
+ 1 =>
+ PHPStan\Type\NullType::__set_state(array(
+ )),
+ ),
)),
2 =>
- PHPStan\Type\StringType::__set_state(array(
+ PHPStan\Type\IntegerType::__set_state(array(
)),
3 =>
- PHPStan\Type\StringType::__set_state(array(
- )),
- 4 =>
- PHPStan\Type\StringType::__set_state(array(
- )),
- 5 =>
- PHPStan\Type\StringType::__set_state(array(
+ PHPStan\Type\IntegerType::__set_state(array(
)),
),
- 'nextAutoIndex' => 3,
+ 'nextAutoIndex' => 2,
'optionalKeys' =>
array (
),
@@ -82,44 +99,105 @@
'value' => 1,
)),
2 =>
- PHPStan\Type\Constant\ConstantIntegerType::__set_state(array(
- 'value' => 2,
+ PHPStan\Type\Constant\ConstantStringType::__set_state(array(
+ 'value' => 'dbsignature',
+ 'isClassString' => false,
)),
3 =>
PHPStan\Type\Constant\ConstantStringType::__set_state(array(
- 'value' => 'COLUMN_NAME',
+ 'value' => 'grouper',
'isClassString' => false,
)),
- 4 =>
+ ),
+ )),
+ 'itemType' =>
+ PHPStan\Type\UnionType::__set_state(array(
+ 'types' =>
+ array (
+ 0 =>
+ PHPStan\Type\IntegerType::__set_state(array(
+ )),
+ 1 =>
+ PHPStan\Type\StringType::__set_state(array(
+ )),
+ 2 =>
+ PHPStan\Type\NullType::__set_state(array(
+ )),
+ ),
+ )),
+ )),
+ 3 =>
+ PHPStan\Type\Constant\ConstantArrayType::__set_state(array(
+ 'allArrays' => NULL,
+ 'keyTypes' =>
+ array (
+ 0 =>
+ PHPStan\Type\Constant\ConstantStringType::__set_state(array(
+ 'value' => 'dbsignature',
+ 'isClassString' => false,
+ )),
+ 1 =>
+ PHPStan\Type\Constant\ConstantStringType::__set_state(array(
+ 'value' => 'grouper',
+ 'isClassString' => false,
+ )),
+ ),
+ 'valueTypes' =>
+ array (
+ 0 =>
+ PHPStan\Type\UnionType::__set_state(array(
+ 'types' =>
+ array (
+ 0 =>
+ PHPStan\Type\StringType::__set_state(array(
+ )),
+ 1 =>
+ PHPStan\Type\NullType::__set_state(array(
+ )),
+ ),
+ )),
+ 1 =>
+ PHPStan\Type\IntegerType::__set_state(array(
+ )),
+ ),
+ 'nextAutoIndex' => 0,
+ 'optionalKeys' =>
+ array (
+ ),
+ 'keyType' =>
+ PHPStan\Type\UnionType::__set_state(array(
+ 'types' =>
+ array (
+ 0 =>
PHPStan\Type\Constant\ConstantStringType::__set_state(array(
- 'value' => 'COLUMN_TYPE',
+ 'value' => 'dbsignature',
'isClassString' => false,
)),
- 5 =>
+ 1 =>
PHPStan\Type\Constant\ConstantStringType::__set_state(array(
- 'value' => 'EXTRA',
+ 'value' => 'grouper',
'isClassString' => false,
)),
),
)),
'itemType' =>
- PHPStan\Type\StringType::__set_state(array(
+ PHPStan\Type\UnionType::__set_state(array(
+ 'types' =>
+ array (
+ 0 =>
+ PHPStan\Type\IntegerType::__set_state(array(
+ )),
+ 1 =>
+ PHPStan\Type\StringType::__set_state(array(
+ )),
+ 2 =>
+ PHPStan\Type\NullType::__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
coalesce(COLUMN_NAME, "") as COLUMN_NAME,
coalesce(EXTRA, "") as EXTRA,
diff --git a/README.md b/README.md
index 279a4fa40..59c5669ca 100644
--- a/README.md
+++ b/README.md
@@ -36,10 +36,11 @@ composer require --dev staabm/phpstan-dba
```php
debugMode(true);
// $config->stringifyTypes(true);
+// TODO: Put your database credentials here
+$mysqli = new mysqli('hostname', 'username', 'password', 'database');
+
QueryReflection::setupReflector(
- new RecordingQueryReflector(
+ new ReplayAndRecordingQueryReflector(
ReflectionCache::create(
$cacheFile
),
- // TODO: Put your database credentials here
- new MysqliQueryReflector(new mysqli('hostname', 'username', 'password', 'database'))
+ // XXX alternatively you can use PdoQueryReflector instead
+ new MysqliQueryReflector($mysqli),
+ new SchemaHasherMysql($mysqli)
+
),
$config
);
@@ -71,9 +77,9 @@ Your `phpstan.neon` might look something like:
```neon
parameters:
- level: 9
+ level: 8
paths:
- - public
+ - src/
bootstrapFiles:
- phpstan-dba-bootstrap.php
@@ -100,7 +106,8 @@ If not configured otherwise, the following defaults are used:
### Record and Replay
-In case you don't want to depend on a database at PHPStan analysis time, you can use the [`RecordingQueryReflector`](https://github.com/staabm/phpstan-dba/blob/main/src/QueryReflection/RecordingQueryReflector.php) to record the reflection information.
+In case you don't want to depend on a database at PHPStan analysis time, you can use one of the `*RecordingQueryReflector`-classes to record the reflection information.
+
With this cache file you can utilize [`ReplayQueryReflector`](https://github.com/staabm/phpstan-dba/blob/main/src/QueryReflection/ReplayQueryReflector.php) to replay the reflection information, without the need for a active database connection.
```php
@@ -135,6 +142,34 @@ This might be usefull if your CI pipeline can't/shouldn't connect to your develo
**Note**: In case you commit the generated cache files into your repository, consider [marking them as generated files](https://docs.github.com/en/repositories/working-with-files/managing-files/customizing-how-changed-files-appear-on-github), so they don't show up in Pull Requests.
+## Reflector Overview
+
+### Backend Connecting Reflector
+
+These reflectors connect to a real database, infer types based on result-set/schema metadata and are able to detect errors within a given sql query.
+It is **not** mandatory to use the same database driver for phpstan-dba, as you use within your application code.
+
+| Reflector | Key Features |
+|----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| MysqliQueryReflector | - limited to mysql/mariadb databases
- requires a active database connection
- most feature complete reflector |
+| PdoQueryReflector | - connects to a mysql/mariadb database
- requires a active database connection
- can be used as a foundation for other database types in the future |
+
+### Utility Reflectors
+
+Utility reflectors will be used in combination with backend connecting reflectors to provide additional features.
+
+| Reflector | Key Features |
+|----------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| ReplayAndRecordingQueryReflector | - wraps a backend connecting reflector, caches the reflected information into a local file and utilizes the cached information
- will re-validate the cached information
- will update local cache file information, even on external changes
- will reduce database interactions to a minimum, but still requires a active database connection |
+| ReplayQueryReflector | - utilizes the cached information of a `*RecordingQueryReflector`
- will **not** validate the cached information, therefore might return stale results
- does **not** require a active database connection |
+| ChainedReflector | - chain several backend connecting reflectors, so applications which use multiple database connections can be analyzed |
+
+Legacy utility reflectors
+
+| Reflector | Key Features |
+|----------------------------------|------------------------------------------------------------------------------------------------------|
+| RecordingQueryReflector | - wraps a backend connecting reflector and caches the reflected information into a local file
-requires a active database connection |
+
## Advanced Usage
### use `SyntaxErrorInPreparedStatementMethodRule` for your custom classes
diff --git a/bootstrap.php b/bootstrap.php
index d657e68cf..4989f0c14 100644
--- a/bootstrap.php
+++ b/bootstrap.php
@@ -10,6 +10,10 @@
$config->errorMode(RuntimeConfiguration::ERROR_MODE_EXCEPTION);
// $config->debugMode(true);
+if (false === getenv('GITHUB_ACTION') && false === getenv('DBA_MODE')) {
+ putenv('DBA_MODE=replay-and-recording');
+}
+
$reflector = ReflectorFactory::create(__DIR__);
QueryReflection::setupReflector(
diff --git a/composer.json b/composer.json
index 53c566d50..962c106bc 100644
--- a/composer.json
+++ b/composer.json
@@ -46,12 +46,16 @@
"@csfix"
],
"record": [
+ "@putenv DBA_MODE=recording",
+
"@putenv DBA_REFLECTOR=mysqli",
"@phpunit",
"@phpstan",
+
"@putenv DBA_REFLECTOR=pdo",
"@phpunit",
"@phpstan",
+
"@csfix"
],
"phpstan": [
diff --git a/src/CacheNotPopulatedException.php b/src/CacheNotPopulatedException.php
new file mode 100644
index 000000000..65456f7ac
--- /dev/null
+++ b/src/CacheNotPopulatedException.php
@@ -0,0 +1,7 @@
+connection = $connection;
+ }
+
+ public function hashDb(): string
+ {
+ if (null !== $this->hash) {
+ return $this->hash;
+ }
+
+ // for a schema with 3.000 columns we need roughly
+ // 70.000 group concat max length
+ $maxConcatQuery = 'SET SESSION group_concat_max_len = 1000000';
+ $this->connection->query($maxConcatQuery);
+
+ $query = '
+ 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';
+
+ $hash = '';
+ if ($this->connection instanceof PDO) {
+ $stmt = $this->connection->query($query);
+ foreach ($stmt as $row) {
+ $hash = $row['dbsignature'] ?? '';
+ }
+ } else {
+ $result = $this->connection->query($query);
+ if ($result instanceof \mysqli_result) {
+ $row = $result->fetch_assoc();
+ $hash = $row['dbsignature'] ?? '';
+ }
+ }
+
+ if ('' === $hash) {
+ throw new ShouldNotHappenException();
+ }
+
+ return $this->hash = $hash;
+ }
+}
diff --git a/src/QueryReflection/ReflectionCache.php b/src/QueryReflection/ReflectionCache.php
index 20877ccb2..0c71b22ae 100644
--- a/src/QueryReflection/ReflectionCache.php
+++ b/src/QueryReflection/ReflectionCache.php
@@ -7,12 +7,13 @@
use const LOCK_EX;
use PHPStan\ShouldNotHappenException;
use PHPStan\Type\Type;
+use staabm\PHPStanDba\CacheNotPopulatedException;
use staabm\PHPStanDba\DbaException;
use staabm\PHPStanDba\Error;
final class ReflectionCache
{
- public const SCHEMA_VERSION = 'v5-runtime-config-bugfix';
+ public const SCHEMA_VERSION = 'v6-schema-hash';
/**
* @var string
@@ -29,6 +30,16 @@ final class ReflectionCache
*/
private $changes = [];
+ /**
+ * @var string|null
+ */
+ private $schemaHash;
+
+ /**
+ * @var bool
+ */
+ private $cacheIsDirty = false;
+
/**
* @var bool
*/
@@ -69,6 +80,27 @@ public static function load(string $cacheFile): self
return new self($cacheFile);
}
+ /**
+ * @return string|null
+ */
+ public function getSchemaHash()
+ {
+ if (null === $this->schemaHash) {
+ $this->lazyReadRecords();
+ }
+
+ return $this->schemaHash;
+ }
+
+ /**
+ * @return void
+ */
+ public function setSchemaHash(string $hash)
+ {
+ $this->cacheIsDirty = true;
+ $this->schemaHash = $hash;
+ }
+
/**
* @return array}>
*/
@@ -111,7 +143,10 @@ private function readCachedRecords(bool $useReadLock): ?array
}
}
- if (!\is_array($cache) || !\array_key_exists('schemaVersion', $cache) || self::SCHEMA_VERSION !== $cache['schemaVersion']) {
+ if (!\is_array($cache) ||
+ !\array_key_exists('schemaVersion', $cache) ||
+ !\array_key_exists('schemaHash', $cache) ||
+ self::SCHEMA_VERSION !== $cache['schemaVersion']) {
return null;
}
@@ -119,6 +154,12 @@ private function readCachedRecords(bool $useReadLock): ?array
return null;
}
+ if (null === $this->schemaHash) {
+ $this->schemaHash = $cache['schemaHash'];
+ } elseif ($this->schemaHash !== $cache['schemaHash']) {
+ return null;
+ }
+
if (!\is_array($cache['records'])) {
throw new ShouldNotHappenException();
}
@@ -128,7 +169,7 @@ private function readCachedRecords(bool $useReadLock): ?array
public function persist(): void
{
- if (0 === \count($this->changes)) {
+ if (false === $this->cacheIsDirty) {
return;
}
@@ -156,6 +197,7 @@ public function persist(): void
$cacheContent = ' self::SCHEMA_VERSION,
+ 'schemaHash' => $this->schemaHash,
'records' => $newRecords,
'runtimeConfig' => QueryReflection::getRuntimeConfiguration()->toArray(),
], true).';';
@@ -186,17 +228,20 @@ public function hasValidationError(string $queryString): bool
return \array_key_exists('error', $cacheEntry);
}
+ /**
+ * @throws CacheNotPopulatedException
+ */
public function getValidationError(string $queryString): ?Error
{
$records = $this->lazyReadRecords();
if (!\array_key_exists($queryString, $records)) {
- throw new DbaException(sprintf('Cache not populated for query "%s"', $queryString));
+ throw new CacheNotPopulatedException(sprintf('Cache not populated for query "%s"', $queryString));
}
$cacheEntry = $this->records[$queryString];
if (!\array_key_exists('error', $cacheEntry)) {
- throw new DbaException(sprintf('Cache not populated for query "%s"', $queryString));
+ throw new CacheNotPopulatedException(sprintf('Cache not populated for query "%s"', $queryString));
}
return $cacheEntry['error'];
@@ -208,10 +253,12 @@ public function putValidationError(string $queryString, ?Error $error): void
if (!\array_key_exists($queryString, $records)) {
$this->changes[$queryString] = $this->records[$queryString] = [];
+ $this->cacheIsDirty = true;
}
if (!\array_key_exists('error', $this->records[$queryString]) || $this->records[$queryString]['error'] !== $error) {
$this->changes[$queryString]['error'] = $this->records[$queryString]['error'] = $error;
+ $this->cacheIsDirty = true;
}
}
@@ -236,22 +283,24 @@ public function hasResultType(string $queryString, int $fetchType): bool
/**
* @param QueryReflector::FETCH_TYPE* $fetchType
+ *
+ * @throws CacheNotPopulatedException
*/
public function getResultType(string $queryString, int $fetchType): ?Type
{
$records = $this->lazyReadRecords();
if (!\array_key_exists($queryString, $records)) {
- throw new DbaException(sprintf('Cache not populated for query "%s"', $queryString));
+ throw new CacheNotPopulatedException(sprintf('Cache not populated for query "%s"', $queryString));
}
$cacheEntry = $this->records[$queryString];
if (!\array_key_exists('result', $cacheEntry)) {
- throw new DbaException(sprintf('Cache not populated for query "%s"', $queryString));
+ throw new CacheNotPopulatedException(sprintf('Cache not populated for query "%s"', $queryString));
}
if (!\array_key_exists($fetchType, $cacheEntry['result'])) {
- throw new DbaException(sprintf('Cache not populated for query "%s"', $queryString));
+ throw new CacheNotPopulatedException(sprintf('Cache not populated for query "%s"', $queryString));
}
return $cacheEntry['result'][$fetchType];
@@ -266,15 +315,18 @@ public function putResultType(string $queryString, int $fetchType, ?Type $result
if (!\array_key_exists($queryString, $records)) {
$this->changes[$queryString] = $this->records[$queryString] = [];
+ $this->cacheIsDirty = true;
}
if (!\array_key_exists('result', $this->records[$queryString])) {
$this->changes[$queryString]['result'] = $this->records[$queryString]['result'] = [];
+ $this->cacheIsDirty = true;
}
// @phpstan-ignore-next-line
if (!\array_key_exists($fetchType, $this->records[$queryString]['result']) || $this->records[$queryString]['result'][$fetchType] !== $resultType) {
$this->changes[$queryString]['result'][$fetchType] = $this->records[$queryString]['result'][$fetchType] = $resultType;
+ $this->cacheIsDirty = true;
}
}
}
diff --git a/src/QueryReflection/ReplayAndRecordingQueryReflector.php b/src/QueryReflection/ReplayAndRecordingQueryReflector.php
new file mode 100644
index 000000000..adcd2b598
--- /dev/null
+++ b/src/QueryReflection/ReplayAndRecordingQueryReflector.php
@@ -0,0 +1,73 @@
+replayReflector = new ReplayQueryReflector($reflectionCache);
+
+ $this->queryReflector = $queryReflector;
+ $this->schemaHasher = $schemaHasher;
+ $this->reflectionCache = $reflectionCache;
+ }
+
+ private function dbSchemaChanged(): bool
+ {
+ $schemaHash = $this->schemaHasher->hashDb();
+ $cachedSchemaHash = $this->reflectionCache->getSchemaHash();
+
+ return $schemaHash !== $cachedSchemaHash;
+ }
+
+ private function createRecordingReflector(): RecordingQueryReflector
+ {
+ if (null === $this->recordingReflector) {
+ $this->reflectionCache->setSchemaHash($this->schemaHasher->hashDb());
+ $this->recordingReflector = new RecordingQueryReflector($this->reflectionCache, $this->queryReflector);
+ }
+
+ return $this->recordingReflector;
+ }
+
+ public function validateQueryString(string $queryString): ?Error
+ {
+ if ($this->dbSchemaChanged()) {
+ return $this->createRecordingReflector()->validateQueryString($queryString);
+ }
+
+ try {
+ return $this->replayReflector->validateQueryString($queryString);
+ } catch (CacheNotPopulatedException $e) {
+ return $this->createRecordingReflector()->validateQueryString($queryString);
+ }
+ }
+
+ public function getResultType(string $queryString, int $fetchType): ?Type
+ {
+ if ($this->dbSchemaChanged()) {
+ return $this->createRecordingReflector()->getResultType($queryString, $fetchType);
+ }
+
+ try {
+ return $this->replayReflector->getResultType($queryString, $fetchType);
+ } catch (CacheNotPopulatedException $e) {
+ return $this->createRecordingReflector()->getResultType($queryString, $fetchType);
+ }
+ }
+}
diff --git a/tests/ReflectorFactory.php b/tests/ReflectorFactory.php
index 757e87a0e..18c8f890b 100644
--- a/tests/ReflectorFactory.php
+++ b/tests/ReflectorFactory.php
@@ -4,11 +4,13 @@
use mysqli;
use PDO;
+use staabm\PHPStanDba\DbSchema\SchemaHasherMysql;
use staabm\PHPStanDba\QueryReflection\MysqliQueryReflector;
use staabm\PHPStanDba\QueryReflection\PdoQueryReflector;
use staabm\PHPStanDba\QueryReflection\QueryReflector;
use staabm\PHPStanDba\QueryReflection\RecordingQueryReflector;
use staabm\PHPStanDba\QueryReflection\ReflectionCache;
+use staabm\PHPStanDba\QueryReflection\ReplayAndRecordingQueryReflector;
use staabm\PHPStanDba\QueryReflection\ReplayQueryReflector;
final class ReflectorFactory
@@ -42,28 +44,38 @@ public static function create(string $cacheDir): QueryReflector
$cacheFile = $cacheDir.'/.phpstan-dba-'.$reflector.'.cache';
}
- if ('recording' === $mode) {
+ $reflectionCache = ReflectionCache::create(
+ $cacheFile
+ );
+
+ if ('recording' === $mode || 'replay-and-recording' === $mode) {
if ('mysqli' === $reflector) {
$mysqli = new mysqli($host, $user, $password, $dbname);
$reflector = new MysqliQueryReflector($mysqli);
+ $schemaHasher = new SchemaHasherMysql($mysqli);
} elseif ('pdo' === $reflector) {
$pdo = new PDO(sprintf('mysql:dbname=%s;host=%s', $dbname, $host), $user, $password);
$reflector = new PdoQueryReflector($pdo);
+ $schemaHasher = new SchemaHasherMysql($pdo);
} else {
throw new \RuntimeException('Unknown reflector: '.$reflector);
}
- $reflector = new RecordingQueryReflector(
- ReflectionCache::create(
- $cacheFile
- ),
- $reflector
- );
+ if ('replay-and-recording' === $mode) {
+ $reflector = new ReplayAndRecordingQueryReflector(
+ $reflectionCache,
+ $reflector,
+ $schemaHasher
+ );
+ } else {
+ $reflector = new RecordingQueryReflector(
+ $reflectionCache,
+ $reflector
+ );
+ }
} elseif ('replay' === $mode) {
$reflector = new ReplayQueryReflector(
- ReflectionCache::create(
- $cacheFile
- )
+ $reflectionCache
);
} else {
throw new \RuntimeException('Unknown mode: '.$mode);
diff --git a/tests/default/config/.phpstan-dba-mysqli.cache b/tests/default/config/.phpstan-dba-mysqli.cache
index 8c671ee01..ffc4f73d5 100644
--- a/tests/default/config/.phpstan-dba-mysqli.cache
+++ b/tests/default/config/.phpstan-dba-mysqli.cache
@@ -1,5 +1,6 @@
'v5-runtime-config-bugfix',
+ 'schemaVersion' => 'v6-schema-hash',
+ 'schemaHash' => NULL,
'records' =>
array (
'SELECT * FROM typemix' =>
@@ -1349,165 +1350,6 @@
)),
),
),
- 'SELECT a.email, b.adaid, b.gesperrt FROM ada a LEFT JOIN ada b ON a.adaid=b.adaid' =>
- array (
- 'result' =>
- array (
- 5 =>
- PHPStan\Type\Constant\ConstantArrayType::__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,
- )),
- ),
- 'valueTypes' =>
- array (
- 0 =>
- PHPStan\Type\StringType::__set_state(array(
- )),
- 1 =>
- PHPStan\Type\StringType::__set_state(array(
- )),
- 2 =>
- PHPStan\Type\UnionType::__set_state(array(
- 'types' =>
- array (
- 0 =>
- PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => 0,
- 'max' => 4294967295,
- )),
- 1 =>
- PHPStan\Type\NullType::__set_state(array(
- )),
- ),
- )),
- 3 =>
- PHPStan\Type\UnionType::__set_state(array(
- 'types' =>
- array (
- 0 =>
- PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => 0,
- 'max' => 4294967295,
- )),
- 1 =>
- PHPStan\Type\NullType::__set_state(array(
- )),
- ),
- )),
- 4 =>
- PHPStan\Type\UnionType::__set_state(array(
- 'types' =>
- array (
- 0 =>
- PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => -128,
- 'max' => 127,
- )),
- 1 =>
- PHPStan\Type\NullType::__set_state(array(
- )),
- ),
- )),
- 5 =>
- PHPStan\Type\UnionType::__set_state(array(
- 'types' =>
- array (
- 0 =>
- PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => -128,
- 'max' => 127,
- )),
- 1 =>
- PHPStan\Type\NullType::__set_state(array(
- )),
- ),
- )),
- ),
- 'nextAutoIndex' => 3,
- 'optionalKeys' =>
- 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\ConstantStringType::__set_state(array(
- 'value' => 'adaid',
- 'isClassString' => false,
- )),
- 4 =>
- PHPStan\Type\Constant\ConstantStringType::__set_state(array(
- 'value' => 'email',
- 'isClassString' => false,
- )),
- 5 =>
- 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(
- )),
- 2 =>
- PHPStan\Type\NullType::__set_state(array(
- )),
- ),
- )),
- )),
- ),
- ),
'SELECT adaid FROM ada' =>
array (
'result' =>
diff --git a/tests/default/config/.phpstan-dba-pdo.cache b/tests/default/config/.phpstan-dba-pdo.cache
index 3b507a686..ffc4f73d5 100644
--- a/tests/default/config/.phpstan-dba-pdo.cache
+++ b/tests/default/config/.phpstan-dba-pdo.cache
@@ -1,5 +1,6 @@
'v5-runtime-config-bugfix',
+ 'schemaVersion' => 'v6-schema-hash',
+ 'schemaHash' => NULL,
'records' =>
array (
'SELECT * FROM typemix' =>
@@ -1349,165 +1350,6 @@
)),
),
),
- 'SELECT a.email, b.adaid, b.gesperrt FROM ada a LEFT JOIN ada b ON a.adaid=b.adaid' =>
- array (
- 'result' =>
- array (
- 5 =>
- PHPStan\Type\Constant\ConstantArrayType::__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,
- )),
- ),
- 'valueTypes' =>
- array (
- 0 =>
- PHPStan\Type\StringType::__set_state(array(
- )),
- 1 =>
- PHPStan\Type\StringType::__set_state(array(
- )),
- 2 =>
- PHPStan\Type\UnionType::__set_state(array(
- 'types' =>
- array (
- 0 =>
- PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => -2147483648,
- 'max' => 2147483647,
- )),
- 1 =>
- PHPStan\Type\NullType::__set_state(array(
- )),
- ),
- )),
- 3 =>
- PHPStan\Type\UnionType::__set_state(array(
- 'types' =>
- array (
- 0 =>
- PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => -2147483648,
- 'max' => 2147483647,
- )),
- 1 =>
- PHPStan\Type\NullType::__set_state(array(
- )),
- ),
- )),
- 4 =>
- PHPStan\Type\UnionType::__set_state(array(
- 'types' =>
- array (
- 0 =>
- PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => -128,
- 'max' => 127,
- )),
- 1 =>
- PHPStan\Type\NullType::__set_state(array(
- )),
- ),
- )),
- 5 =>
- PHPStan\Type\UnionType::__set_state(array(
- 'types' =>
- array (
- 0 =>
- PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => -128,
- 'max' => 127,
- )),
- 1 =>
- PHPStan\Type\NullType::__set_state(array(
- )),
- ),
- )),
- ),
- 'nextAutoIndex' => 3,
- 'optionalKeys' =>
- 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\ConstantStringType::__set_state(array(
- 'value' => 'adaid',
- 'isClassString' => false,
- )),
- 4 =>
- PHPStan\Type\Constant\ConstantStringType::__set_state(array(
- 'value' => 'email',
- 'isClassString' => false,
- )),
- 5 =>
- 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' => -2147483648,
- 'max' => 2147483647,
- )),
- 1 =>
- PHPStan\Type\StringType::__set_state(array(
- )),
- 2 =>
- PHPStan\Type\NullType::__set_state(array(
- )),
- ),
- )),
- )),
- ),
- ),
'SELECT adaid FROM ada' =>
array (
'result' =>
diff --git a/tests/default/config/.phpunit-phpstan-dba-mysqli.cache b/tests/default/config/.phpunit-phpstan-dba-mysqli.cache
index 5a05ff32c..2b05f8473 100644
--- a/tests/default/config/.phpunit-phpstan-dba-mysqli.cache
+++ b/tests/default/config/.phpunit-phpstan-dba-mysqli.cache
@@ -1,5 +1,6 @@
'v5-runtime-config-bugfix',
+ 'schemaVersion' => 'v6-schema-hash',
+ 'schemaHash' => NULL,
'records' =>
array (
'SELECT * FROM typemix' =>
diff --git a/tests/default/config/.phpunit-phpstan-dba-pdo.cache b/tests/default/config/.phpunit-phpstan-dba-pdo.cache
index 06e5b7f97..684117962 100644
--- a/tests/default/config/.phpunit-phpstan-dba-pdo.cache
+++ b/tests/default/config/.phpunit-phpstan-dba-pdo.cache
@@ -1,5 +1,6 @@
'v5-runtime-config-bugfix',
+ 'schemaVersion' => 'v6-schema-hash',
+ 'schemaHash' => NULL,
'records' =>
array (
'SELECT * FROM typemix' =>
@@ -1349,165 +1350,6 @@
)),
),
),
- 'SELECT a.email, b.adaid, b.gesperrt FROM ada a LEFT JOIN ada b ON a.adaid=b.adaid' =>
- array (
- 'result' =>
- array (
- 5 =>
- PHPStan\Type\Constant\ConstantArrayType::__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,
- )),
- ),
- 'valueTypes' =>
- array (
- 0 =>
- PHPStan\Type\StringType::__set_state(array(
- )),
- 1 =>
- PHPStan\Type\StringType::__set_state(array(
- )),
- 2 =>
- PHPStan\Type\UnionType::__set_state(array(
- 'types' =>
- array (
- 0 =>
- PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => -2147483648,
- 'max' => 2147483647,
- )),
- 1 =>
- PHPStan\Type\NullType::__set_state(array(
- )),
- ),
- )),
- 3 =>
- PHPStan\Type\UnionType::__set_state(array(
- 'types' =>
- array (
- 0 =>
- PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => -2147483648,
- 'max' => 2147483647,
- )),
- 1 =>
- PHPStan\Type\NullType::__set_state(array(
- )),
- ),
- )),
- 4 =>
- PHPStan\Type\UnionType::__set_state(array(
- 'types' =>
- array (
- 0 =>
- PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => -128,
- 'max' => 127,
- )),
- 1 =>
- PHPStan\Type\NullType::__set_state(array(
- )),
- ),
- )),
- 5 =>
- PHPStan\Type\UnionType::__set_state(array(
- 'types' =>
- array (
- 0 =>
- PHPStan\Type\IntegerRangeType::__set_state(array(
- 'min' => -128,
- 'max' => 127,
- )),
- 1 =>
- PHPStan\Type\NullType::__set_state(array(
- )),
- ),
- )),
- ),
- 'nextAutoIndex' => 3,
- 'optionalKeys' =>
- 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\ConstantStringType::__set_state(array(
- 'value' => 'adaid',
- 'isClassString' => false,
- )),
- 4 =>
- PHPStan\Type\Constant\ConstantStringType::__set_state(array(
- 'value' => 'email',
- 'isClassString' => false,
- )),
- 5 =>
- 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' => -2147483648,
- 'max' => 2147483647,
- )),
- 1 =>
- PHPStan\Type\StringType::__set_state(array(
- )),
- 2 =>
- PHPStan\Type\NullType::__set_state(array(
- )),
- ),
- )),
- )),
- ),
- ),
'SELECT adaid FROM ada' =>
array (
'result' =>
diff --git a/tests/defaultFetchAssoc/config/.phpstan-dba-mysqli.cache b/tests/defaultFetchAssoc/config/.phpstan-dba-mysqli.cache
index 2e85e5d4a..bd3337730 100644
--- a/tests/defaultFetchAssoc/config/.phpstan-dba-mysqli.cache
+++ b/tests/defaultFetchAssoc/config/.phpstan-dba-mysqli.cache
@@ -1,5 +1,6 @@
'v5-runtime-config-bugfix',
+ 'schemaVersion' => 'v6-schema-hash',
+ 'schemaHash' => NULL,
'records' =>
array (
'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada' =>
diff --git a/tests/defaultFetchAssoc/config/.phpstan-dba-pdo.cache b/tests/defaultFetchAssoc/config/.phpstan-dba-pdo.cache
index 2e85e5d4a..bd3337730 100644
--- a/tests/defaultFetchAssoc/config/.phpstan-dba-pdo.cache
+++ b/tests/defaultFetchAssoc/config/.phpstan-dba-pdo.cache
@@ -1,5 +1,6 @@
'v5-runtime-config-bugfix',
+ 'schemaVersion' => 'v6-schema-hash',
+ 'schemaHash' => NULL,
'records' =>
array (
'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada' =>
diff --git a/tests/defaultFetchAssoc/config/.phpunit-phpstan-dba-mysqli.cache b/tests/defaultFetchAssoc/config/.phpunit-phpstan-dba-mysqli.cache
index 2e85e5d4a..bd3337730 100644
--- a/tests/defaultFetchAssoc/config/.phpunit-phpstan-dba-mysqli.cache
+++ b/tests/defaultFetchAssoc/config/.phpunit-phpstan-dba-mysqli.cache
@@ -1,5 +1,6 @@
'v5-runtime-config-bugfix',
+ 'schemaVersion' => 'v6-schema-hash',
+ 'schemaHash' => NULL,
'records' =>
array (
'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada' =>
diff --git a/tests/defaultFetchAssoc/config/.phpunit-phpstan-dba-pdo.cache b/tests/defaultFetchAssoc/config/.phpunit-phpstan-dba-pdo.cache
index 2e85e5d4a..bd3337730 100644
--- a/tests/defaultFetchAssoc/config/.phpunit-phpstan-dba-pdo.cache
+++ b/tests/defaultFetchAssoc/config/.phpunit-phpstan-dba-pdo.cache
@@ -1,5 +1,6 @@
'v5-runtime-config-bugfix',
+ 'schemaVersion' => 'v6-schema-hash',
+ 'schemaHash' => NULL,
'records' =>
array (
'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada' =>
diff --git a/tests/defaultFetchNumeric/config/.phpstan-dba-mysqli.cache b/tests/defaultFetchNumeric/config/.phpstan-dba-mysqli.cache
index 2e85e5d4a..bd3337730 100644
--- a/tests/defaultFetchNumeric/config/.phpstan-dba-mysqli.cache
+++ b/tests/defaultFetchNumeric/config/.phpstan-dba-mysqli.cache
@@ -1,5 +1,6 @@
'v5-runtime-config-bugfix',
+ 'schemaVersion' => 'v6-schema-hash',
+ 'schemaHash' => NULL,
'records' =>
array (
'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada' =>
diff --git a/tests/defaultFetchNumeric/config/.phpstan-dba-pdo.cache b/tests/defaultFetchNumeric/config/.phpstan-dba-pdo.cache
index 2e85e5d4a..bd3337730 100644
--- a/tests/defaultFetchNumeric/config/.phpstan-dba-pdo.cache
+++ b/tests/defaultFetchNumeric/config/.phpstan-dba-pdo.cache
@@ -1,5 +1,6 @@
'v5-runtime-config-bugfix',
+ 'schemaVersion' => 'v6-schema-hash',
+ 'schemaHash' => NULL,
'records' =>
array (
'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada' =>
diff --git a/tests/defaultFetchNumeric/config/.phpunit-phpstan-dba-mysqli.cache b/tests/defaultFetchNumeric/config/.phpunit-phpstan-dba-mysqli.cache
index 2e85e5d4a..bd3337730 100644
--- a/tests/defaultFetchNumeric/config/.phpunit-phpstan-dba-mysqli.cache
+++ b/tests/defaultFetchNumeric/config/.phpunit-phpstan-dba-mysqli.cache
@@ -1,5 +1,6 @@
'v5-runtime-config-bugfix',
+ 'schemaVersion' => 'v6-schema-hash',
+ 'schemaHash' => NULL,
'records' =>
array (
'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada' =>
diff --git a/tests/defaultFetchNumeric/config/.phpunit-phpstan-dba-pdo.cache b/tests/defaultFetchNumeric/config/.phpunit-phpstan-dba-pdo.cache
index 2e85e5d4a..bd3337730 100644
--- a/tests/defaultFetchNumeric/config/.phpunit-phpstan-dba-pdo.cache
+++ b/tests/defaultFetchNumeric/config/.phpunit-phpstan-dba-pdo.cache
@@ -1,5 +1,6 @@
'v5-runtime-config-bugfix',
+ 'schemaVersion' => 'v6-schema-hash',
+ 'schemaHash' => NULL,
'records' =>
array (
'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada' =>
diff --git a/tests/rules/config/.phpstan-dba-mysqli.cache b/tests/rules/config/.phpstan-dba-mysqli.cache
index 9c571785b..85b20e992 100644
--- a/tests/rules/config/.phpstan-dba-mysqli.cache
+++ b/tests/rules/config/.phpstan-dba-mysqli.cache
@@ -1,5 +1,6 @@
'v5-runtime-config-bugfix',
+ 'schemaVersion' => 'v6-schema-hash',
+ 'schemaHash' => NULL,
'records' =>
array (
'SELECT * FROM ada GROUP BY doesNotExist' =>
@@ -23,13 +24,6 @@
5 => NULL,
),
),
- 'SELECT * FROM unknownTable' =>
- array (
- 'result' =>
- array (
- 5 => NULL,
- ),
- ),
'SELECT * FROM unknown_table' =>
array (
'result' =>
@@ -979,6 +973,7 @@
array (
'result' =>
array (
+ 3 => NULL,
5 => NULL,
),
),
diff --git a/tests/rules/config/.phpstan-dba-pdo.cache b/tests/rules/config/.phpstan-dba-pdo.cache
index 072b54040..85b20e992 100644
--- a/tests/rules/config/.phpstan-dba-pdo.cache
+++ b/tests/rules/config/.phpstan-dba-pdo.cache
@@ -1,5 +1,6 @@
'v5-runtime-config-bugfix',
+ 'schemaVersion' => 'v6-schema-hash',
+ 'schemaHash' => NULL,
'records' =>
array (
'SELECT * FROM ada GROUP BY doesNotExist' =>
@@ -23,13 +24,6 @@
5 => NULL,
),
),
- 'SELECT * FROM unknownTable' =>
- array (
- 'result' =>
- array (
- 5 => NULL,
- ),
- ),
'SELECT * FROM unknown_table' =>
array (
'result' =>
@@ -980,6 +974,7 @@
'result' =>
array (
3 => NULL,
+ 5 => NULL,
),
),
'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada WHERE gesperrt=1' =>
diff --git a/tests/rules/config/.phpunit-phpstan-dba-mysqli.cache b/tests/rules/config/.phpunit-phpstan-dba-mysqli.cache
index 39b9d5b00..587c1c994 100644
--- a/tests/rules/config/.phpunit-phpstan-dba-mysqli.cache
+++ b/tests/rules/config/.phpunit-phpstan-dba-mysqli.cache
@@ -1,5 +1,6 @@
'v5-runtime-config-bugfix',
+ 'schemaVersion' => 'v6-schema-hash',
+ 'schemaHash' => NULL,
'records' =>
array (
'
@@ -264,14 +265,6 @@
'code' => 1054,
)),
),
- 'SELECT * FROM unknownTable' =>
- array (
- 'error' =>
- staabm\PHPStanDba\Error::__set_state(array(
- 'message' => 'Table \'phpstan_dba.unknownTable\' doesn\'t exist',
- 'code' => 1146,
- )),
- ),
'SELECT * FROM unknown_table' =>
array (
'error' =>
diff --git a/tests/rules/config/.phpunit-phpstan-dba-pdo.cache b/tests/rules/config/.phpunit-phpstan-dba-pdo.cache
index b2cd9735a..d62c55139 100644
--- a/tests/rules/config/.phpunit-phpstan-dba-pdo.cache
+++ b/tests/rules/config/.phpunit-phpstan-dba-pdo.cache
@@ -1,5 +1,6 @@
'v5-runtime-config-bugfix',
+ 'schemaVersion' => 'v6-schema-hash',
+ 'schemaHash' => NULL,
'records' =>
array (
'
@@ -121,125 +122,6 @@
array (
'error' => 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' =>
@@ -264,14 +146,6 @@
'code' => '42S22',
)),
),
- 'SELECT * FROM unknownTable' =>
- array (
- 'error' =>
- staabm\PHPStanDba\Error::__set_state(array(
- 'message' => 'SQLSTATE[42S02]: Base table or view not found: 1146 Table \'phpstan_dba.unknownTable\' doesn\'t exist',
- 'code' => '42S02',
- )),
- ),
'SELECT * FROM unknown_table' =>
array (
'error' =>
@@ -365,11 +239,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/stringify/config/.phpstan-dba-mysqli.cache b/tests/stringify/config/.phpstan-dba-mysqli.cache
index e642704e4..5f95a8356 100644
--- a/tests/stringify/config/.phpstan-dba-mysqli.cache
+++ b/tests/stringify/config/.phpstan-dba-mysqli.cache
@@ -1,5 +1,6 @@
'v5-runtime-config-bugfix',
+ 'schemaVersion' => 'v6-schema-hash',
+ 'schemaHash' => NULL,
'records' =>
array (
'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada' =>
diff --git a/tests/stringify/config/.phpstan-dba-pdo.cache b/tests/stringify/config/.phpstan-dba-pdo.cache
index e642704e4..5f95a8356 100644
--- a/tests/stringify/config/.phpstan-dba-pdo.cache
+++ b/tests/stringify/config/.phpstan-dba-pdo.cache
@@ -1,5 +1,6 @@
'v5-runtime-config-bugfix',
+ 'schemaVersion' => 'v6-schema-hash',
+ 'schemaHash' => NULL,
'records' =>
array (
'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada' =>
diff --git a/tests/stringify/config/.phpunit-phpstan-dba-mysqli.cache b/tests/stringify/config/.phpunit-phpstan-dba-mysqli.cache
index e642704e4..5f95a8356 100644
--- a/tests/stringify/config/.phpunit-phpstan-dba-mysqli.cache
+++ b/tests/stringify/config/.phpunit-phpstan-dba-mysqli.cache
@@ -1,5 +1,6 @@
'v5-runtime-config-bugfix',
+ 'schemaVersion' => 'v6-schema-hash',
+ 'schemaHash' => NULL,
'records' =>
array (
'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada' =>
diff --git a/tests/stringify/config/.phpunit-phpstan-dba-pdo.cache b/tests/stringify/config/.phpunit-phpstan-dba-pdo.cache
index e642704e4..5f95a8356 100644
--- a/tests/stringify/config/.phpunit-phpstan-dba-pdo.cache
+++ b/tests/stringify/config/.phpunit-phpstan-dba-pdo.cache
@@ -1,5 +1,6 @@
'v5-runtime-config-bugfix',
+ 'schemaVersion' => 'v6-schema-hash',
+ 'schemaHash' => NULL,
'records' =>
array (
'SELECT email, adaid, gesperrt, freigabe1u1 FROM ada' =>