Skip to content

Commit 10c2200

Browse files
authored
fix deprecations (#546)
1 parent f45d816 commit 10c2200

File tree

4 files changed

+5
-25
lines changed

4 files changed

+5
-25
lines changed

phpstan-baseline.neon

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,6 @@ parameters:
5858
count: 1
5959
path: src/Extensions/PdoStatementFetchDynamicReturnTypeExtension.php
6060

61-
-
62-
message: "#^Strict comparison using \\!\\=\\= between null and PHPStan\\\\Type\\\\Type will always evaluate to true\\.$#"
63-
count: 1
64-
path: src/Extensions/PdoStatementFetchDynamicReturnTypeExtension.php
65-
6661
-
6762
message: "#^Doing instanceof PHPStan\\\\Type\\\\Constant\\\\ConstantStringType is error\\-prone and deprecated\\. Use Type\\:\\:getConstantStrings\\(\\) instead\\.$#"
6863
count: 1
@@ -88,22 +83,6 @@ parameters:
8883
count: 1
8984
path: src/QueryReflection/DbaApi.php
9085

91-
-
92-
message: """
93-
#^Call to deprecated method getConstantArrays\\(\\) of class PHPStan\\\\Type\\\\TypeUtils\\:
94-
Use PHPStan\\\\Type\\\\Type\\:\\:getConstantArrays\\(\\) instead and handle optional keys if necessary\\.$#
95-
"""
96-
count: 1
97-
path: src/QueryReflection/QueryReflection.php
98-
99-
-
100-
message: """
101-
#^Call to deprecated method getConstantStrings\\(\\) of class PHPStan\\\\Type\\\\TypeUtils\\:
102-
Use PHPStan\\\\Type\\\\Type\\:\\:getConstantStrings\\(\\) instead$#
103-
"""
104-
count: 1
105-
path: src/QueryReflection/QueryReflection.php
106-
10786
-
10887
message: """
10988
#^Call to deprecated method resolvePreparedQueryString\\(\\) of class staabm\\\\PHPStanDba\\\\QueryReflection\\\\QueryReflection\\:

phpstan.neon.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ includes:
55
- phpstan-baseline.neon
66

77
parameters:
8+
editorUrl: 'phpstorm://open?file=%%file%%&line=%%line%%'
9+
810
level: max
911

1012
paths:

src/Extensions/PdoStatementFetchDynamicReturnTypeExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method
6767
}
6868

6969
// fetchAll() can return false prior to php8
70-
if (null !== $returnType && ! $returnType instanceof MixedType && 'fetchAll' === $methodReflection->getName() && $this->phpVersion->getVersionId() >= 80000) {
70+
if (! $returnType instanceof MixedType && 'fetchAll' === $methodReflection->getName() && $this->phpVersion->getVersionId() >= 80000) {
7171
$returnType = TypeCombinator::remove($returnType, new ConstantBooleanType(false));
7272
}
7373

src/QueryReflection/QueryReflection.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
use PHPStan\Type\StringType;
2424
use PHPStan\Type\Type;
2525
use PHPStan\Type\TypeCombinator;
26-
use PHPStan\Type\TypeUtils;
2726
use PHPStan\Type\UnionType;
2827
use staabm\PHPStanDba\Analyzer\QueryPlanAnalyzerMysql;
2928
use staabm\PHPStanDba\Analyzer\QueryPlanQueryResolver;
@@ -223,7 +222,7 @@ public function resolvePreparedQueryStrings(Expr $queryExpr, Type $parameterType
223222
return null;
224223
}
225224

226-
foreach (TypeUtils::getConstantStrings($type) as $constantString) {
225+
foreach ($type->getConstantStrings() as $constantString) {
227226
$queryString = $constantString->getValue();
228227
$queryString = $this->replaceParameters($queryString, $parameters);
229228
yield $this->normalizeQueryString($queryString);
@@ -407,7 +406,7 @@ public function resolveParameters(Type $parameterTypes): ?array
407406
$parameters = [];
408407

409408
if ($parameterTypes instanceof UnionType) {
410-
foreach (TypeUtils::getConstantArrays($parameterTypes) as $constantArray) {
409+
foreach ($parameterTypes->getConstantArrays() as $constantArray) {
411410
$parameters = $parameters + $this->resolveConstantArray($constantArray, true);
412411
}
413412

0 commit comments

Comments
 (0)