Skip to content

Commit f591900

Browse files
staabmclxmstaab
andauthored
enforce strict comparison (#260)
Co-authored-by: Markus Staab <[email protected]>
1 parent 772b4cd commit f591900

File tree

5 files changed

+5
-6
lines changed

5 files changed

+5
-6
lines changed

.php-cs-fixer.dist.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
->setRules([
1717
'@Symfony' => true,
1818
'@Symfony:risky' => true,
19+
'strict_param' => true,
1920
'array_syntax' => ['syntax' => 'short'],
2021
'fopen_flags' => false,
2122
'ordered_imports' => true,

src/Extensions/PdoStatementFetchDynamicReturnTypeExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ private function inferType(MethodReflection $methodReflection, MethodCall $metho
7474
}
7575
$fetchType = $fetchModeType->getValue();
7676

77-
if (!\in_array($fetchType, [PDO::FETCH_ASSOC, PDO::FETCH_NUM, PDO::FETCH_BOTH])) {
77+
if (!\in_array($fetchType, [PDO::FETCH_ASSOC, PDO::FETCH_NUM, PDO::FETCH_BOTH], true)) {
7878
return null;
7979
}
8080
}

src/PdoReflection/PdoStatementReflection.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ public function findPrepareQueryStringExpression(MethodReflection $methodReflect
3434
}
3535

3636
/**
37-
* // the following param doesnt work, see phpstan bug https://github.com/phpstan/phpstan/issues/6577.
38-
*
39-
* @xx-param PDO::FETCH* $fetchType
37+
* @param PDO::FETCH* $fetchType
4038
*
4139
* @return Type|null
4240
*/

src/QueryReflection/ChainedReflector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function validateQueryString(string $queryString): ?Error
3131

3232
// on "not found" error, we try the next reflector.
3333
if ($reflectorError) {
34-
if (!\in_array($reflectorError->getCode(), [MysqliQueryReflector::MYSQL_UNKNOWN_TABLE])) {
34+
if (!\in_array($reflectorError->getCode(), [MysqliQueryReflector::MYSQL_UNKNOWN_TABLE], true)) {
3535
return $reflectorError;
3636
}
3737
if (true === $nooneKnows) {

src/QueryReflection/PlaceholderValidation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ private function validateNamedPlaceholders(string $queryString, array $parameter
111111
if ($parameter->isOptional) {
112112
continue;
113113
}
114-
if (!\in_array($placeholderKey, $namedPlaceholders)) {
114+
if (!\in_array($placeholderKey, $namedPlaceholders, true)) {
115115
yield sprintf('Value %s is given, but the query does not contain this placeholder.', $placeholderKey);
116116
}
117117
}

0 commit comments

Comments
 (0)