Skip to content

Commit 4f15453

Browse files
committed
fix
1 parent 484bc27 commit 4f15453

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

phpstan-baseline.neon

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ parameters:
1919
path: src/Extensions/DeployerRunMysqlQueryDynamicReturnTypeExtension.php
2020

2121
-
22-
message: "#^Call to an undefined method PHPStan\\\\Type\\\\Type\\:\\:getValueTypes\\(\\)\\.$#"
23-
count: 5
22+
message: "#^Doing instanceof PHPStan\\\\Type\\\\Constant\\\\ConstantArrayType is error\\-prone and deprecated\\. Use Type\\:\\:getConstantArrays\\(\\) instead\\.$#"
23+
count: 2
2424
path: src/Extensions/DibiConnectionFetchDynamicReturnTypeExtension.php
2525

2626
-
@@ -48,11 +48,6 @@ parameters:
4848
count: 1
4949
path: src/PdoReflection/PdoStatementObjectType.php
5050

51-
-
52-
message: "#^Doing instanceof PHPStan\\\\Type\\\\Constant\\\\ConstantStringType is error\\-prone and deprecated\\. Use Type\\:\\:getConstantStrings\\(\\) instead\\.$#"
53-
count: 1
54-
path: src/PdoReflection/PdoStatementObjectType.php
55-
5651
-
5752
message: "#^Doing instanceof PHPStan\\\\Type\\\\Constant\\\\ConstantArrayType is error\\-prone and deprecated\\. Use Type\\:\\:getConstantArrays\\(\\) instead\\.$#"
5853
count: 1
@@ -244,11 +239,6 @@ parameters:
244239
count: 1
245240
path: src/Rules/SyntaxErrorInQueryMethodRule.php
246241

247-
-
248-
message: "#^Doing instanceof PHPStan\\\\Type\\\\Constant\\\\ConstantArrayType is error\\-prone and deprecated\\. Use Type\\:\\:getConstantArrays\\(\\) instead\\.$#"
249-
count: 1
250-
path: src/SchemaReflection/SchemaReflection.php
251-
252242
-
253243
message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#"
254244
count: 1

src/SchemaReflection/SchemaReflection.php

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

55
namespace staabm\PHPStanDba\SchemaReflection;
66

7-
use PHPStan\Type\Constant\ConstantArrayType;
7+
use PHPStan\Type\Type;
88

99
final class SchemaReflection
1010
{
@@ -33,10 +33,15 @@ public function getTable(string $tableName): ?Table
3333
}
3434

3535
$resultType = ($this->queryResolver)('SELECT * FROM ' . $tableName);
36-
if (! $resultType instanceof ConstantArrayType) {
36+
if (!$resultType instanceof Type) {
37+
return $this->tables[$tableName] = null;
38+
}
39+
$arrays = $resultType->getConstantArrays();
40+
if (count($arrays) !== 1) {
3741
return $this->tables[$tableName] = null;
3842
}
3943

44+
$resultType = $arrays[0];
4045
$keyTypes = $resultType->getKeyTypes();
4146
$valueTypes = $resultType->getValueTypes();
4247
$columns = [];

0 commit comments

Comments
 (0)