Skip to content

Commit a5c7e09

Browse files
staabmclxmstaab
andauthored
introduce PdoMysqlQueryReflector and deprecate PdoQueryReflector (#370)
Co-authored-by: Markus Staab <[email protected]>
1 parent d448d1f commit a5c7e09

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+183
-161
lines changed

.gitattributes

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# mark cache files as generated files, so they don't show up in Pull Requests diffs
22
.phpstan-dba-mysqli.cache linguist-generated=true
3-
.phpstan-dba-pdo.cache linguist-generated=true
3+
.phpstan-dba-pdo-mysql.cache linguist-generated=true
44
.phpunit-phpstan-dba-mysqli.cache linguist-generated=true
5-
.phpunit-phpstan-dba-pdo.cache linguist-generated=true
5+
.phpunit-phpstan-dba-pdo-mysql.cache linguist-generated=true
66
.phpunit-phpstan-dba-pdo-pgsql.cache linguist-generated=true
77

88
# Exclude non-essential files from dist
99
/tests export-ignore
1010
.phpunit-phpstan-dba-mysqli.cache
11-
.phpunit-phpstan-dba-pdo.cache
11+
.phpunit-phpstan-dba-pdo-mysql.cache
1212
.phpunit-phpstan-dba-pdo-pgsql.cache

.github/workflows/phpstan.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
include:
1919
- php-version: "8.0"
2020
db-image: 'mysql:8.0'
21-
reflector: "pdo"
21+
reflector: "pdo-mysql"
2222
mode: "recording"
2323
- php-version: "8.0"
2424
db-image: 'mysql:8.0'
@@ -88,7 +88,7 @@ jobs:
8888
reflector: "mysqli"
8989
mode: "replay"
9090
- php-version: "8.1"
91-
reflector: "pdo"
91+
reflector: "pdo-mysql"
9292
mode: "replay"
9393

9494
env:

.github/workflows/tests.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ jobs:
1818
include:
1919
- php-version: "7.4"
2020
db-image: 'mysql:8.0'
21-
reflector: "pdo"
21+
reflector: "pdo-mysql"
2222
mode: "recording"
2323
- php-version: "8.0"
2424
db-image: 'mysql:8.0'
25-
reflector: "pdo"
25+
reflector: "pdo-mysql"
2626
mode: "recording"
2727
- php-version: "8.0"
2828
db-image: 'mysql:8.0'
@@ -40,7 +40,7 @@ jobs:
4040

4141
- php-version: "8.1"
4242
db-image: 'mysql:8.0'
43-
reflector: "pdo"
43+
reflector: "pdo-mysql"
4444
mode: "replay-and-recording"
4545

4646
env:
@@ -94,7 +94,7 @@ jobs:
9494
matrix:
9595
include:
9696
- php-version: "8.1"
97-
reflector: "pdo"
97+
reflector: "pdo-mysql"
9898
mode: "replay"
9999
- php-version: "8.1"
100100
reflector: "mysqli"

.phpstan-dba-mysqli.cache

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.phpstan-dba-pdo.cache renamed to .phpstan-dba-pdo-mysql.cache

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ QueryReflection::setupReflector(
5858
ReflectionCache::create(
5959
$cacheFile
6060
),
61-
// XXX alternatively you can use PdoQueryReflector instead
61+
// XXX alternatively you can use PdoMysqlQueryReflector instead
6262
new MysqliQueryReflector($mysqli),
6363
new SchemaHasherMysql($mysqli)
6464

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"@phpunit",
5454
"@phpstan",
5555

56-
"@putenv DBA_REFLECTOR=pdo",
56+
"@putenv DBA_REFLECTOR=pdo-mysql",
5757
"@phpunit",
5858
"@phpstan",
5959

docs/mysql.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Analyzing MySQL based codebases is supported for Doctrine DBAL, PDO and mysqli.
44

5-
At analysis time you can pick either `MysqliQueryReflector` or `PdoQueryReflector`.
5+
At analysis time you can pick either `MysqliQueryReflector` or `PdoMysqlQueryReflector`.
66

77
## Configuration
88

@@ -33,7 +33,7 @@ QueryReflection::setupReflector(
3333
ReflectionCache::create(
3434
$cacheFile
3535
),
36-
// XXX alternatively you can use PdoQueryReflector instead
36+
// XXX alternatively you can use PdoMysqlQueryReflector instead
3737
new MysqliQueryReflector($mysqli),
3838
new SchemaHasherMysql($mysqli)
3939

docs/reflectors.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ It is **not** mandatory to use the same database driver for phpstan-dba, as you
88
| Reflector | Key Features |
99
|----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|
1010
| MysqliQueryReflector | - limited to mysql/mariadb databases<br/>- requires a active database connection<br/>- most feature complete reflector |
11-
| PdoQueryReflector | - connects to a mysql/mariadb database<br/>- requires a active database connection |
11+
| PdoMysqlQueryReflector | - connects to a mysql/mariadb database<br/>- requires a active database connection |
1212
| PdoPgSqlQueryReflector | - connects to a PGSQL database<br/>- requires a active database connection |
1313

1414

src/QueryReflection/BasePdoQueryReflector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
/**
1919
* @phpstan-type ColumnMeta array{name: string, table: string, native_type: string, len: int, flags: array<int, string>, precision: int<0, max>, pdo_type: PDO::PARAM_* }
2020
*/
21-
abstract class BasePdoQueryReflector
21+
abstract class BasePdoQueryReflector implements QueryReflector
2222
{
2323
private const PSQL_INVALID_TEXT_REPRESENTATION = '22P02';
2424
private const PSQL_UNDEFINED_COLUMN = '42703';

0 commit comments

Comments
 (0)