diff --git a/.gitattributes b/.gitattributes index 9a55a9bed..56c569352 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,12 +1,12 @@ # mark cache files as generated files, so they don't show up in Pull Requests diffs .phpstan-dba-mysqli.cache linguist-generated=true -.phpstan-dba-pdo.cache linguist-generated=true +.phpstan-dba-pdo-mysql.cache linguist-generated=true .phpunit-phpstan-dba-mysqli.cache linguist-generated=true -.phpunit-phpstan-dba-pdo.cache linguist-generated=true +.phpunit-phpstan-dba-pdo-mysql.cache linguist-generated=true .phpunit-phpstan-dba-pdo-pgsql.cache linguist-generated=true # Exclude non-essential files from dist /tests export-ignore .phpunit-phpstan-dba-mysqli.cache -.phpunit-phpstan-dba-pdo.cache +.phpunit-phpstan-dba-pdo-mysql.cache .phpunit-phpstan-dba-pdo-pgsql.cache diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index e3fee5e55..51288050a 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -18,7 +18,7 @@ jobs: include: - php-version: "8.0" db-image: 'mysql:8.0' - reflector: "pdo" + reflector: "pdo-mysql" mode: "recording" - php-version: "8.0" db-image: 'mysql:8.0' @@ -88,7 +88,7 @@ jobs: reflector: "mysqli" mode: "replay" - php-version: "8.1" - reflector: "pdo" + reflector: "pdo-mysql" mode: "replay" env: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4a17ecd0a..17a5f676c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,11 +18,11 @@ jobs: include: - php-version: "7.4" db-image: 'mysql:8.0' - reflector: "pdo" + reflector: "pdo-mysql" mode: "recording" - php-version: "8.0" db-image: 'mysql:8.0' - reflector: "pdo" + reflector: "pdo-mysql" mode: "recording" - php-version: "8.0" db-image: 'mysql:8.0' @@ -40,7 +40,7 @@ jobs: - php-version: "8.1" db-image: 'mysql:8.0' - reflector: "pdo" + reflector: "pdo-mysql" mode: "replay-and-recording" env: @@ -94,7 +94,7 @@ jobs: matrix: include: - php-version: "8.1" - reflector: "pdo" + reflector: "pdo-mysql" mode: "replay" - php-version: "8.1" reflector: "mysqli" diff --git a/.phpstan-dba-mysqli.cache b/.phpstan-dba-mysqli.cache index c406e68b2..a89ac41e7 100644 --- a/.phpstan-dba-mysqli.cache +++ b/.phpstan-dba-mysqli.cache @@ -1,5 +1,5 @@ 'v7-trim-queries', + 'schemaVersion' => 'v8-trim-queries', 'schemaHash' => NULL, 'records' => array ( diff --git a/.phpstan-dba-pdo.cache b/.phpstan-dba-pdo-mysql.cache similarity index 99% rename from .phpstan-dba-pdo.cache rename to .phpstan-dba-pdo-mysql.cache index c406e68b2..a89ac41e7 100644 --- a/.phpstan-dba-pdo.cache +++ b/.phpstan-dba-pdo-mysql.cache @@ -1,5 +1,5 @@ 'v7-trim-queries', + 'schemaVersion' => 'v8-trim-queries', 'schemaHash' => NULL, 'records' => array ( diff --git a/README.md b/README.md index c771b3709..74c8c514e 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ QueryReflection::setupReflector( ReflectionCache::create( $cacheFile ), - // XXX alternatively you can use PdoQueryReflector instead + // XXX alternatively you can use PdoMysqlQueryReflector instead new MysqliQueryReflector($mysqli), new SchemaHasherMysql($mysqli) diff --git a/composer.json b/composer.json index dab22d884..0e1844ab7 100644 --- a/composer.json +++ b/composer.json @@ -53,7 +53,7 @@ "@phpunit", "@phpstan", - "@putenv DBA_REFLECTOR=pdo", + "@putenv DBA_REFLECTOR=pdo-mysql", "@phpunit", "@phpstan", diff --git a/docs/mysql.md b/docs/mysql.md index ada4d357b..d0dffe000 100644 --- a/docs/mysql.md +++ b/docs/mysql.md @@ -2,7 +2,7 @@ Analyzing MySQL based codebases is supported for Doctrine DBAL, PDO and mysqli. -At analysis time you can pick either `MysqliQueryReflector` or `PdoQueryReflector`. +At analysis time you can pick either `MysqliQueryReflector` or `PdoMysqlQueryReflector`. ## Configuration @@ -33,7 +33,7 @@ QueryReflection::setupReflector( ReflectionCache::create( $cacheFile ), - // XXX alternatively you can use PdoQueryReflector instead + // XXX alternatively you can use PdoMysqlQueryReflector instead new MysqliQueryReflector($mysqli), new SchemaHasherMysql($mysqli) diff --git a/docs/reflectors.md b/docs/reflectors.md index befe5e49e..4eb542bc7 100644 --- a/docs/reflectors.md +++ b/docs/reflectors.md @@ -8,7 +8,7 @@ It is **not** mandatory to use the same database driver for phpstan-dba, as you | 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 | +| PdoMysqlQueryReflector | - connects to a mysql/mariadb database
- requires a active database connection | | PdoPgSqlQueryReflector | - connects to a PGSQL database
- requires a active database connection | diff --git a/src/QueryReflection/BasePdoQueryReflector.php b/src/QueryReflection/BasePdoQueryReflector.php index e43d57113..4fe6f39dc 100644 --- a/src/QueryReflection/BasePdoQueryReflector.php +++ b/src/QueryReflection/BasePdoQueryReflector.php @@ -18,7 +18,7 @@ /** * @phpstan-type ColumnMeta array{name: string, table: string, native_type: string, len: int, flags: array, precision: int<0, max>, pdo_type: PDO::PARAM_* } */ -abstract class BasePdoQueryReflector +abstract class BasePdoQueryReflector implements QueryReflector { private const PSQL_INVALID_TEXT_REPRESENTATION = '22P02'; private const PSQL_UNDEFINED_COLUMN = '42703'; diff --git a/src/QueryReflection/PdoMysqlQueryReflector.php b/src/QueryReflection/PdoMysqlQueryReflector.php new file mode 100644 index 000000000..d90fe1d49 --- /dev/null +++ b/src/QueryReflection/PdoMysqlQueryReflector.php @@ -0,0 +1,125 @@ +setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + + parent::__construct($pdo, new MysqlTypeMapper()); + } + + /** @return PDOException|list|null */ + protected function simulateQuery(string $queryString) + { + if (\array_key_exists($queryString, $this->cache)) { + return $this->cache[$queryString]; + } + + if (\count($this->cache) > self::MAX_CACHE_SIZE) { + // make room for the next element by randomly removing a existing one + array_shift($this->cache); + } + + $simulatedQuery = QuerySimulation::simulate($queryString); + if (null === $simulatedQuery) { + return $this->cache[$queryString] = null; + } + + try { + $this->pdo->beginTransaction(); + } catch (PDOException $e) { + // not all drivers may support transactions + } + + try { + $stmt = $this->pdo->query($simulatedQuery); + } catch (PDOException $e) { + return $this->cache[$queryString] = $e; + } finally { + try { + $this->pdo->rollBack(); + } catch (PDOException $e) { + // not all drivers may support transactions + } + } + + $this->cache[$queryString] = []; + $columnCount = $stmt->columnCount(); + $columnIndex = 0; + while ($columnIndex < $columnCount) { + $columnMeta = $stmt->getColumnMeta($columnIndex); + + if (false === $columnMeta || !\array_key_exists('table', $columnMeta)) { + throw new ShouldNotHappenException('Failed to get column meta for column index '.$columnIndex); + } + + // Native type may not be set, for example in case of JSON column. + if (!\array_key_exists('native_type', $columnMeta)) { + $columnMeta['native_type'] = \PDO::PARAM_INT === $columnMeta['pdo_type'] ? 'INT' : 'STRING'; + } + + $flags = $this->emulateFlags($columnMeta['native_type'], $columnMeta['table'], $columnMeta['name']); + foreach ($flags as $flag) { + $columnMeta['flags'][] = $flag; + } + + // @phpstan-ignore-next-line + $this->cache[$queryString][$columnIndex] = $columnMeta; + ++$columnIndex; + } + + return $this->cache[$queryString]; + } + + /** + * @return Iterator + */ + protected function checkInformationSchema(string $tableName): Iterator + { + if (null === $this->stmt) { + $this->stmt = $this->pdo->prepare( + // EXTRA, COLUMN_NAME seems to be nullable in mariadb + 'SELECT + coalesce(COLUMN_NAME, "") as COLUMN_NAME, + coalesce(EXTRA, "") as EXTRA, + COLUMN_TYPE + FROM information_schema.columns + WHERE table_name = ? AND table_schema = DATABASE()' + ); + } + + $this->stmt->execute([$tableName]); + $result = $this->stmt->fetchAll(PDO::FETCH_ASSOC); + + foreach ($result as $row) { + $extra = $row['EXTRA']; + $columnType = $row['COLUMN_TYPE']; + $columnName = $row['COLUMN_NAME']; + + if (str_contains($extra, 'auto_increment')) { + yield $columnName => TypeMapper::FLAG_AUTO_INCREMENT; + } + if (str_contains($columnType, 'unsigned')) { + yield $columnName => TypeMapper::FLAG_UNSIGNED; + } + } + } +} diff --git a/src/QueryReflection/PdoPgSqlQueryReflector.php b/src/QueryReflection/PdoPgSqlQueryReflector.php index 82ecee933..2d09123c8 100644 --- a/src/QueryReflection/PdoPgSqlQueryReflector.php +++ b/src/QueryReflection/PdoPgSqlQueryReflector.php @@ -15,7 +15,7 @@ /** * @phpstan-type PDOColumnMeta array{name: string, table?: string, native_type: string, len: int, flags: list} */ -final class PdoPgSqlQueryReflector extends BasePdoQueryReflector implements QueryReflector +final class PdoPgSqlQueryReflector extends BasePdoQueryReflector { public function __construct(PDO $pdo) { diff --git a/src/QueryReflection/PdoQueryReflector.php b/src/QueryReflection/PdoQueryReflector.php index 54d793dd9..e8d083537 100644 --- a/src/QueryReflection/PdoQueryReflector.php +++ b/src/QueryReflection/PdoQueryReflector.php @@ -4,120 +4,17 @@ namespace staabm\PHPStanDba\QueryReflection; -use Iterator; use PDO; -use PDOException; -use PHPStan\ShouldNotHappenException; -use PHPStan\Type\Type; -use staabm\PHPStanDba\TypeMapping\MysqlTypeMapper; -use staabm\PHPStanDba\TypeMapping\TypeMapper; /** - * @phpstan-import-type ColumnMeta from BasePdoQueryReflector + * This class was kept for BC reasons. + * + * @deprected use PdoMysqlQueryReflector instead */ -final class PdoQueryReflector extends BasePdoQueryReflector implements QueryReflector +final class PdoQueryReflector extends PdoMysqlQueryReflector // @phpstan-ignore-line { public function __construct(PDO $pdo) { - $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - - parent::__construct($pdo, new MysqlTypeMapper()); - } - - /** @return PDOException|list|null */ - protected function simulateQuery(string $queryString) - { - if (\array_key_exists($queryString, $this->cache)) { - return $this->cache[$queryString]; - } - - if (\count($this->cache) > self::MAX_CACHE_SIZE) { - // make room for the next element by randomly removing a existing one - array_shift($this->cache); - } - - $simulatedQuery = QuerySimulation::simulate($queryString); - if (null === $simulatedQuery) { - return $this->cache[$queryString] = null; - } - - try { - $this->pdo->beginTransaction(); - } catch (PDOException $e) { - // not all drivers may support transactions - } - - try { - $stmt = $this->pdo->query($simulatedQuery); - } catch (PDOException $e) { - return $this->cache[$queryString] = $e; - } finally { - try { - $this->pdo->rollBack(); - } catch (PDOException $e) { - // not all drivers may support transactions - } - } - - $this->cache[$queryString] = []; - $columnCount = $stmt->columnCount(); - $columnIndex = 0; - while ($columnIndex < $columnCount) { - $columnMeta = $stmt->getColumnMeta($columnIndex); - - if (false === $columnMeta || !\array_key_exists('table', $columnMeta)) { - throw new ShouldNotHappenException('Failed to get column meta for column index '.$columnIndex); - } - - // Native type may not be set, for example in case of JSON column. - if (!\array_key_exists('native_type', $columnMeta)) { - $columnMeta['native_type'] = \PDO::PARAM_INT === $columnMeta['pdo_type'] ? 'INT' : 'STRING'; - } - - $flags = $this->emulateFlags($columnMeta['native_type'], $columnMeta['table'], $columnMeta['name']); - foreach ($flags as $flag) { - $columnMeta['flags'][] = $flag; - } - - // @phpstan-ignore-next-line - $this->cache[$queryString][$columnIndex] = $columnMeta; - ++$columnIndex; - } - - return $this->cache[$queryString]; - } - - /** - * @return Iterator - */ - protected function checkInformationSchema(string $tableName): Iterator - { - if (null === $this->stmt) { - $this->stmt = $this->pdo->prepare( - // EXTRA, COLUMN_NAME seems to be nullable in mariadb - 'SELECT - coalesce(COLUMN_NAME, "") as COLUMN_NAME, - coalesce(EXTRA, "") as EXTRA, - COLUMN_TYPE - FROM information_schema.columns - WHERE table_name = ? AND table_schema = DATABASE()' - ); - } - - $this->stmt->execute([$tableName]); - $result = $this->stmt->fetchAll(PDO::FETCH_ASSOC); - - foreach ($result as $row) { - $extra = $row['EXTRA']; - $columnType = $row['COLUMN_TYPE']; - $columnName = $row['COLUMN_NAME']; - - if (str_contains($extra, 'auto_increment')) { - yield $columnName => TypeMapper::FLAG_AUTO_INCREMENT; - } - if (str_contains($columnType, 'unsigned')) { - yield $columnName => TypeMapper::FLAG_UNSIGNED; - } - } + parent::__construct($pdo); } } diff --git a/src/QueryReflection/ReflectionCache.php b/src/QueryReflection/ReflectionCache.php index 81cd23aff..2f8ff6aa1 100644 --- a/src/QueryReflection/ReflectionCache.php +++ b/src/QueryReflection/ReflectionCache.php @@ -13,7 +13,7 @@ final class ReflectionCache { - public const SCHEMA_VERSION = 'v7-trim-queries'; + public const SCHEMA_VERSION = 'v8-trim-queries'; /** * @var string diff --git a/tests/ReflectorFactory.php b/tests/ReflectorFactory.php index f9edd1877..00c589abe 100644 --- a/tests/ReflectorFactory.php +++ b/tests/ReflectorFactory.php @@ -6,8 +6,8 @@ use PDO; use staabm\PHPStanDba\DbSchema\SchemaHasherMysql; use staabm\PHPStanDba\QueryReflection\MysqliQueryReflector; +use staabm\PHPStanDba\QueryReflection\PdoMysqlQueryReflector; use staabm\PHPStanDba\QueryReflection\PdoPgSqlQueryReflector; -use staabm\PHPStanDba\QueryReflection\PdoQueryReflector; use staabm\PHPStanDba\QueryReflection\QueryReflector; use staabm\PHPStanDba\QueryReflection\RecordingQueryReflector; use staabm\PHPStanDba\QueryReflection\ReflectionCache; @@ -61,9 +61,9 @@ public static function create(string $cacheDir): QueryReflector $mysqli = new mysqli($host, $user, $password, $dbname); $reflector = new MysqliQueryReflector($mysqli); $schemaHasher = new SchemaHasherMysql($mysqli); - } elseif ('pdo' === $reflector) { + } elseif ('pdo-mysql' === $reflector) { $pdo = new PDO(sprintf('mysql:dbname=%s;host=%s', $dbname, $host), $user, $password); - $reflector = new PdoQueryReflector($pdo); + $reflector = new PdoMysqlQueryReflector($pdo); $schemaHasher = new SchemaHasherMysql($pdo); } elseif ('pdo-pgsql' === $reflector) { $pdo = new PDO(sprintf('pgsql:dbname=%s;host=%s', $dbname, $host), $user, $password); diff --git a/tests/default/DbaInferenceTest.php b/tests/default/DbaInferenceTest.php index 4ff717c89..9b558ad5f 100644 --- a/tests/default/DbaInferenceTest.php +++ b/tests/default/DbaInferenceTest.php @@ -50,7 +50,7 @@ public function dataFileAsserts(): iterable yield from $this->gatherAssertTypes(__DIR__.'/data/runMysqlQuery.php'); // XXX cases which are not yet supported by the PdoQueryReflector - if ('pdo' !== getenv('DBA_REFLECTOR') && 'pdo-pgsql' !== getenv('DBA_REFLECTOR')) { + if ('pdo-mysql' !== getenv('DBA_REFLECTOR') && 'pdo-pgsql' !== getenv('DBA_REFLECTOR')) { yield from $this->gatherAssertTypes(__DIR__.'/data/query-alias.php'); } diff --git a/tests/default/config/.phpstan-dba-mysqli.cache b/tests/default/config/.phpstan-dba-mysqli.cache index df4e6fdf8..52d40bd65 100644 --- a/tests/default/config/.phpstan-dba-mysqli.cache +++ b/tests/default/config/.phpstan-dba-mysqli.cache @@ -1,5 +1,5 @@ 'v7-trim-queries', + 'schemaVersion' => 'v8-trim-queries', 'schemaHash' => NULL, 'records' => array ( diff --git a/tests/default/config/.phpstan-dba-pdo.cache b/tests/default/config/.phpstan-dba-pdo-mysql.cache similarity index 99% rename from tests/default/config/.phpstan-dba-pdo.cache rename to tests/default/config/.phpstan-dba-pdo-mysql.cache index df4e6fdf8..52d40bd65 100644 --- a/tests/default/config/.phpstan-dba-pdo.cache +++ b/tests/default/config/.phpstan-dba-pdo-mysql.cache @@ -1,5 +1,5 @@ 'v7-trim-queries', + 'schemaVersion' => 'v8-trim-queries', 'schemaHash' => NULL, 'records' => array ( diff --git a/tests/default/config/.phpunit-phpstan-dba-mysqli.cache b/tests/default/config/.phpunit-phpstan-dba-mysqli.cache index 64434076e..f0209baca 100644 --- a/tests/default/config/.phpunit-phpstan-dba-mysqli.cache +++ b/tests/default/config/.phpunit-phpstan-dba-mysqli.cache @@ -1,5 +1,5 @@ 'v7-trim-queries', + 'schemaVersion' => 'v8-trim-queries', 'schemaHash' => NULL, 'records' => array ( diff --git a/tests/default/config/.phpunit-phpstan-dba-pdo.cache b/tests/default/config/.phpunit-phpstan-dba-pdo-mysql.cache similarity index 99% rename from tests/default/config/.phpunit-phpstan-dba-pdo.cache rename to tests/default/config/.phpunit-phpstan-dba-pdo-mysql.cache index 01f1830a9..4cd37aa1a 100644 --- a/tests/default/config/.phpunit-phpstan-dba-pdo.cache +++ b/tests/default/config/.phpunit-phpstan-dba-pdo-mysql.cache @@ -1,5 +1,5 @@ 'v7-trim-queries', + 'schemaVersion' => 'v8-trim-queries', 'schemaHash' => NULL, 'records' => array ( diff --git a/tests/defaultFetchAssoc/config/.phpstan-dba-mysqli.cache b/tests/defaultFetchAssoc/config/.phpstan-dba-mysqli.cache index 396b95b69..3ff22aa78 100644 --- a/tests/defaultFetchAssoc/config/.phpstan-dba-mysqli.cache +++ b/tests/defaultFetchAssoc/config/.phpstan-dba-mysqli.cache @@ -1,5 +1,5 @@ 'v7-trim-queries', + 'schemaVersion' => 'v8-trim-queries', 'schemaHash' => NULL, 'records' => array ( diff --git a/tests/defaultFetchAssoc/config/.phpunit-phpstan-dba-pdo.cache b/tests/defaultFetchAssoc/config/.phpstan-dba-pdo-mysql.cache similarity index 98% rename from tests/defaultFetchAssoc/config/.phpunit-phpstan-dba-pdo.cache rename to tests/defaultFetchAssoc/config/.phpstan-dba-pdo-mysql.cache index 396b95b69..3ff22aa78 100644 --- a/tests/defaultFetchAssoc/config/.phpunit-phpstan-dba-pdo.cache +++ b/tests/defaultFetchAssoc/config/.phpstan-dba-pdo-mysql.cache @@ -1,5 +1,5 @@ 'v7-trim-queries', + 'schemaVersion' => 'v8-trim-queries', 'schemaHash' => NULL, 'records' => array ( diff --git a/tests/defaultFetchAssoc/config/.phpunit-phpstan-dba-mysqli.cache b/tests/defaultFetchAssoc/config/.phpunit-phpstan-dba-mysqli.cache index 396b95b69..3ff22aa78 100644 --- a/tests/defaultFetchAssoc/config/.phpunit-phpstan-dba-mysqli.cache +++ b/tests/defaultFetchAssoc/config/.phpunit-phpstan-dba-mysqli.cache @@ -1,5 +1,5 @@ 'v7-trim-queries', + 'schemaVersion' => 'v8-trim-queries', 'schemaHash' => NULL, 'records' => array ( diff --git a/tests/defaultFetchNumeric/config/.phpstan-dba-pdo.cache b/tests/defaultFetchAssoc/config/.phpunit-phpstan-dba-pdo-mysql.cache similarity index 98% rename from tests/defaultFetchNumeric/config/.phpstan-dba-pdo.cache rename to tests/defaultFetchAssoc/config/.phpunit-phpstan-dba-pdo-mysql.cache index 396b95b69..3ff22aa78 100644 --- a/tests/defaultFetchNumeric/config/.phpstan-dba-pdo.cache +++ b/tests/defaultFetchAssoc/config/.phpunit-phpstan-dba-pdo-mysql.cache @@ -1,5 +1,5 @@ 'v7-trim-queries', + 'schemaVersion' => 'v8-trim-queries', 'schemaHash' => NULL, 'records' => array ( diff --git a/tests/defaultFetchNumeric/config/.phpstan-dba-mysqli.cache b/tests/defaultFetchNumeric/config/.phpstan-dba-mysqli.cache index 396b95b69..3ff22aa78 100644 --- a/tests/defaultFetchNumeric/config/.phpstan-dba-mysqli.cache +++ b/tests/defaultFetchNumeric/config/.phpstan-dba-mysqli.cache @@ -1,5 +1,5 @@ 'v7-trim-queries', + 'schemaVersion' => 'v8-trim-queries', 'schemaHash' => NULL, 'records' => array ( diff --git a/tests/defaultFetchNumeric/config/.phpunit-phpstan-dba-pdo.cache b/tests/defaultFetchNumeric/config/.phpstan-dba-pdo-mysql.cache similarity index 98% rename from tests/defaultFetchNumeric/config/.phpunit-phpstan-dba-pdo.cache rename to tests/defaultFetchNumeric/config/.phpstan-dba-pdo-mysql.cache index 396b95b69..3ff22aa78 100644 --- a/tests/defaultFetchNumeric/config/.phpunit-phpstan-dba-pdo.cache +++ b/tests/defaultFetchNumeric/config/.phpstan-dba-pdo-mysql.cache @@ -1,5 +1,5 @@ 'v7-trim-queries', + 'schemaVersion' => 'v8-trim-queries', 'schemaHash' => NULL, 'records' => array ( diff --git a/tests/defaultFetchNumeric/config/.phpunit-phpstan-dba-mysqli.cache b/tests/defaultFetchNumeric/config/.phpunit-phpstan-dba-mysqli.cache index 396b95b69..3ff22aa78 100644 --- a/tests/defaultFetchNumeric/config/.phpunit-phpstan-dba-mysqli.cache +++ b/tests/defaultFetchNumeric/config/.phpunit-phpstan-dba-mysqli.cache @@ -1,5 +1,5 @@ 'v7-trim-queries', + 'schemaVersion' => 'v8-trim-queries', 'schemaHash' => NULL, 'records' => array ( diff --git a/tests/defaultFetchAssoc/config/.phpstan-dba-pdo.cache b/tests/defaultFetchNumeric/config/.phpunit-phpstan-dba-pdo-mysql.cache similarity index 98% rename from tests/defaultFetchAssoc/config/.phpstan-dba-pdo.cache rename to tests/defaultFetchNumeric/config/.phpunit-phpstan-dba-pdo-mysql.cache index 396b95b69..3ff22aa78 100644 --- a/tests/defaultFetchAssoc/config/.phpstan-dba-pdo.cache +++ b/tests/defaultFetchNumeric/config/.phpunit-phpstan-dba-pdo-mysql.cache @@ -1,5 +1,5 @@ 'v7-trim-queries', + 'schemaVersion' => 'v8-trim-queries', 'schemaHash' => NULL, 'records' => array ( diff --git a/tests/rules/SyntaxErrorInPreparedStatementMethodRulePdoReflectorTest.php b/tests/rules/SyntaxErrorInPreparedStatementMethodRulePdoReflectorTest.php index 6aafc74b8..ef0ea05da 100644 --- a/tests/rules/SyntaxErrorInPreparedStatementMethodRulePdoReflectorTest.php +++ b/tests/rules/SyntaxErrorInPreparedStatementMethodRulePdoReflectorTest.php @@ -25,8 +25,8 @@ public static function getAdditionalConfigFiles(): array public function testSyntaxErrorInQueryRule(): void { - if ('pdo' !== getenv('DBA_REFLECTOR')) { - $this->markTestSkipped('Only works with PdoReflector'); + if ('pdo-mysql' !== getenv('DBA_REFLECTOR')) { + $this->markTestSkipped('Only works with PdoMysqlQueryReflector'); } require_once __DIR__.'/data/syntax-error-in-prepared-statement.php'; diff --git a/tests/rules/SyntaxErrorInPreparedStatementMethodSubclassedRulePdoReflectorTest.php b/tests/rules/SyntaxErrorInPreparedStatementMethodSubclassedRulePdoReflectorTest.php index d4edd2fd0..911059f5d 100644 --- a/tests/rules/SyntaxErrorInPreparedStatementMethodSubclassedRulePdoReflectorTest.php +++ b/tests/rules/SyntaxErrorInPreparedStatementMethodSubclassedRulePdoReflectorTest.php @@ -25,8 +25,8 @@ public static function getAdditionalConfigFiles(): array public function testSyntaxErrorInQueryRule(): void { - if ('pdo' !== getenv('DBA_REFLECTOR')) { - $this->markTestSkipped('Only works with MysqliReflector'); + if ('pdo-mysql' !== getenv('DBA_REFLECTOR')) { + $this->markTestSkipped('Only works with PdoMysqlQueryReflector'); } require_once __DIR__.'/data/syntax-error-in-method-subclassed.php'; diff --git a/tests/rules/SyntaxErrorInQueryFunctionRulePdoReflectorTest.php b/tests/rules/SyntaxErrorInQueryFunctionRulePdoReflectorTest.php index 84619ee20..df2de4a9f 100644 --- a/tests/rules/SyntaxErrorInQueryFunctionRulePdoReflectorTest.php +++ b/tests/rules/SyntaxErrorInQueryFunctionRulePdoReflectorTest.php @@ -25,8 +25,8 @@ public static function getAdditionalConfigFiles(): array public function testSyntaxErrorInQueryRule(): void { - if ('pdo' !== getenv('DBA_REFLECTOR')) { - $this->markTestSkipped('Only works with PdoQueryReflector'); + if ('pdo-mysql' !== getenv('DBA_REFLECTOR')) { + $this->markTestSkipped('Only works with PdoMysqlQueryReflector'); } require_once __DIR__.'/data/syntax-error-in-query-function.php'; diff --git a/tests/rules/SyntaxErrorInQueryMethodRulePdoReflectorTest.php b/tests/rules/SyntaxErrorInQueryMethodRulePdoReflectorTest.php index 81b42f76f..fa009fa2f 100644 --- a/tests/rules/SyntaxErrorInQueryMethodRulePdoReflectorTest.php +++ b/tests/rules/SyntaxErrorInQueryMethodRulePdoReflectorTest.php @@ -25,8 +25,8 @@ public static function getAdditionalConfigFiles(): array public function testSyntaxErrorInQueryRule(): void { - if ('pdo' !== getenv('DBA_REFLECTOR')) { - $this->markTestSkipped('Only works with MysqliReflector'); + if ('pdo-mysql' !== getenv('DBA_REFLECTOR')) { + $this->markTestSkipped('Only works with PdoMysqlQueryReflector'); } require_once __DIR__.'/data/syntax-error-in-query-method.php'; diff --git a/tests/rules/SyntaxErrorInQueryMethodSubclassedRulePdoReflectorTest.php b/tests/rules/SyntaxErrorInQueryMethodSubclassedRulePdoReflectorTest.php index 6239f7dca..dbdc36a9c 100644 --- a/tests/rules/SyntaxErrorInQueryMethodSubclassedRulePdoReflectorTest.php +++ b/tests/rules/SyntaxErrorInQueryMethodSubclassedRulePdoReflectorTest.php @@ -25,8 +25,8 @@ public static function getAdditionalConfigFiles(): array public function testSyntaxErrorInQueryRule(): void { - if ('pdo' !== getenv('DBA_REFLECTOR')) { - $this->markTestSkipped('Only works with MysqliReflector'); + if ('pdo-mysql' !== getenv('DBA_REFLECTOR')) { + $this->markTestSkipped('Only works with PdoMysqlQueryReflector'); } require_once __DIR__.'/data/syntax-error-in-method-subclassed.php'; diff --git a/tests/rules/config/.phpstan-dba-mysqli.cache b/tests/rules/config/.phpstan-dba-mysqli.cache index d12cf4ce5..34ea981ce 100644 --- a/tests/rules/config/.phpstan-dba-mysqli.cache +++ b/tests/rules/config/.phpstan-dba-mysqli.cache @@ -1,5 +1,5 @@ 'v7-trim-queries', + 'schemaVersion' => 'v8-trim-queries', 'schemaHash' => NULL, 'records' => array ( diff --git a/tests/rules/config/.phpstan-dba-pdo.cache b/tests/rules/config/.phpstan-dba-pdo-mysql.cache similarity index 99% rename from tests/rules/config/.phpstan-dba-pdo.cache rename to tests/rules/config/.phpstan-dba-pdo-mysql.cache index d12cf4ce5..34ea981ce 100644 --- a/tests/rules/config/.phpstan-dba-pdo.cache +++ b/tests/rules/config/.phpstan-dba-pdo-mysql.cache @@ -1,5 +1,5 @@ 'v7-trim-queries', + 'schemaVersion' => 'v8-trim-queries', 'schemaHash' => NULL, 'records' => array ( diff --git a/tests/rules/config/.phpunit-phpstan-dba-mysqli.cache b/tests/rules/config/.phpunit-phpstan-dba-mysqli.cache index d5395a1eb..d731f4753 100644 --- a/tests/rules/config/.phpunit-phpstan-dba-mysqli.cache +++ b/tests/rules/config/.phpunit-phpstan-dba-mysqli.cache @@ -1,5 +1,5 @@ 'v7-trim-queries', + 'schemaVersion' => 'v8-trim-queries', 'schemaHash' => NULL, 'records' => array ( diff --git a/tests/rules/config/.phpunit-phpstan-dba-pdo.cache b/tests/rules/config/.phpunit-phpstan-dba-pdo-mysql.cache similarity index 99% rename from tests/rules/config/.phpunit-phpstan-dba-pdo.cache rename to tests/rules/config/.phpunit-phpstan-dba-pdo-mysql.cache index 2e1f6f385..8cc8f1bf0 100644 --- a/tests/rules/config/.phpunit-phpstan-dba-pdo.cache +++ b/tests/rules/config/.phpunit-phpstan-dba-pdo-mysql.cache @@ -1,5 +1,5 @@ 'v7-trim-queries', + 'schemaVersion' => 'v8-trim-queries', 'schemaHash' => NULL, 'records' => array ( diff --git a/tests/stringify/config/.phpstan-dba-mysqli.cache b/tests/stringify/config/.phpstan-dba-mysqli.cache index ab22077ab..d7786f2df 100644 --- a/tests/stringify/config/.phpstan-dba-mysqli.cache +++ b/tests/stringify/config/.phpstan-dba-mysqli.cache @@ -1,5 +1,5 @@ 'v7-trim-queries', + 'schemaVersion' => 'v8-trim-queries', 'schemaHash' => NULL, 'records' => array ( diff --git a/tests/stringify/config/.phpstan-dba-pdo.cache b/tests/stringify/config/.phpstan-dba-pdo-mysql.cache similarity index 99% rename from tests/stringify/config/.phpstan-dba-pdo.cache rename to tests/stringify/config/.phpstan-dba-pdo-mysql.cache index ab22077ab..d7786f2df 100644 --- a/tests/stringify/config/.phpstan-dba-pdo.cache +++ b/tests/stringify/config/.phpstan-dba-pdo-mysql.cache @@ -1,5 +1,5 @@ 'v7-trim-queries', + 'schemaVersion' => 'v8-trim-queries', 'schemaHash' => NULL, 'records' => array ( diff --git a/tests/stringify/config/.phpunit-phpstan-dba-mysqli.cache b/tests/stringify/config/.phpunit-phpstan-dba-mysqli.cache index d906bf98f..782dbcb32 100644 --- a/tests/stringify/config/.phpunit-phpstan-dba-mysqli.cache +++ b/tests/stringify/config/.phpunit-phpstan-dba-mysqli.cache @@ -1,5 +1,5 @@ 'v7-trim-queries', + 'schemaVersion' => 'v8-trim-queries', 'schemaHash' => NULL, 'records' => array ( diff --git a/tests/stringify/config/.phpunit-phpstan-dba-pdo.cache b/tests/stringify/config/.phpunit-phpstan-dba-pdo-mysql.cache similarity index 99% rename from tests/stringify/config/.phpunit-phpstan-dba-pdo.cache rename to tests/stringify/config/.phpunit-phpstan-dba-pdo-mysql.cache index d906bf98f..782dbcb32 100644 --- a/tests/stringify/config/.phpunit-phpstan-dba-pdo.cache +++ b/tests/stringify/config/.phpunit-phpstan-dba-pdo-mysql.cache @@ -1,5 +1,5 @@ 'v7-trim-queries', + 'schemaVersion' => 'v8-trim-queries', 'schemaHash' => NULL, 'records' => array (