Skip to content

Commit c7c417b

Browse files
authored
Fix build with latest PHPStan (#764)
1 parent d930145 commit c7c417b

File tree

9 files changed

+43
-36
lines changed

9 files changed

+43
-36
lines changed

.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-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.

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@
4242
"tests/defaultFetchAssoc/data/",
4343
"tests/defaultFetchNumeric/data/",
4444
"tests/rules/data/",
45-
"tests/stringify/data/"
45+
"tests/stringify/data/",
46+
"tests/sqlAst/data"
4647
]
4748
},
4849
"scripts": {

phpstan-baseline.neon

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ parameters:
2727
count: 1
2828
path: src/QueryReflection/DbaApi.php
2929

30+
-
31+
message: '#^Cannot access offset int\<0, max\> on array\<array\{name\: string, table\: string, native_type\: string, len\: int, flags\: array\<int, string\>, precision\: int\<0, max\>, pdo_type\: 0\|1\|2\|3\|4\|5\|6\|536870912\|1073741824\|2147483648\}\>\|PDOException\|null\.$#'
32+
identifier: offsetAccess.nonOffsetAccessible
33+
count: 1
34+
path: src/QueryReflection/PdoMysqlQueryReflector.php
35+
3036
-
3137
message: '''
3238
#^Call to deprecated method resolvePreparedQueryString\(\) of class staabm\\PHPStanDba\\QueryReflection\\QueryReflection\:

tests/default/data/pdo-mysql.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function aggregateFunctions(PDO $pdo)
2121
$query = 'SELECT MAX(adaid), MIN(adaid), COUNT(adaid), AVG(adaid) FROM ada WHERE adaid = 1';
2222
$stmt = $pdo->query($query, PDO::FETCH_ASSOC);
2323
foreach ($stmt as $row) {
24-
assertType('array{MAX(adaid): int<-32768, 32767>|null, MIN(adaid): int<-32768, 32767>|null, COUNT(adaid): int, AVG(adaid): numeric-string|null}', $row);
24+
assertType("array{'MAX(adaid)': int<-32768, 32767>|null, 'MIN(adaid)': int<-32768, 32767>|null, 'COUNT(adaid)': int, 'AVG(adaid)': numeric-string|null}", $row);
2525
}
2626
}
2727

tests/sqlAst/config/.phpunit-phpstan-dba-mysqli.cache

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/sqlAst/config/.phpunit-phpstan-dba-pdo-mysql.cache

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/sqlAst/data/sql-ast-narrowing.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public function count(PDO $pdo): void
141141

142142
$stmt = $pdo->query('SELECT count(email) as myemail, count(email) from ada');
143143
foreach ($stmt as $row) {
144-
assertType('array{myemail: int<0, max>, 0: int<0, max>, count(email): int<0, max>, 1: int<0, max>}', $row);
144+
assertType("array{myemail: int<0, max>, 0: int<0, max>, 'count(email)': int<0, max>, 1: int<0, max>}", $row);
145145
}
146146
}
147147

tests/stringify/data/ast-narrowed-stringify.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function count(PDO $pdo): void
1616

1717
$stmt = $pdo->query('SELECT count(email) as myemail, count(email) from ada');
1818
foreach ($stmt as $row) {
19-
assertType("array{myemail: numeric-string, 0: numeric-string, count(email): numeric-string, 1: numeric-string}", $row);
19+
assertType("array{myemail: numeric-string, 0: numeric-string, 'count(email)': numeric-string, 1: numeric-string}", $row);
2020
}
2121
}
2222
}

0 commit comments

Comments
 (0)