Skip to content

Commit c1fd22b

Browse files
authored
Merge pull request #23144 from nextcloud/enh/noid/update-param-for-psalm
Less psalm warnings
2 parents 99c101c + 0e3ddf1 commit c1fd22b

4 files changed

Lines changed: 19 additions & 17 deletions

File tree

lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
use OC\DB\QueryBuilder\QuoteHelper;
3434
use OCP\DB\QueryBuilder\IExpressionBuilder;
3535
use OCP\DB\QueryBuilder\ILiteral;
36+
use OCP\DB\QueryBuilder\IParameter;
3637
use OCP\DB\QueryBuilder\IQueryBuilder;
3738
use OCP\DB\QueryBuilder\IQueryFunction;
3839
use OCP\IDBConnection;
@@ -278,7 +279,7 @@ public function isNotNull($x) {
278279
/**
279280
* Creates a LIKE() comparison expression with the given arguments.
280281
*
281-
* @param string $x Field in string format to be inspected by LIKE() comparison.
282+
* @param ILiteral|IParameter|IQueryFunction|string $x Field in string format to be inspected by LIKE() comparison.
282283
* @param mixed $y Argument to be used in LIKE() comparison.
283284
* @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
284285
* required when comparing text fields for oci compatibility
@@ -309,7 +310,7 @@ public function iLike($x, $y, $type = null) {
309310
/**
310311
* Creates a NOT LIKE() comparison expression with the given arguments.
311312
*
312-
* @param string $x Field in string format to be inspected by NOT LIKE() comparison.
313+
* @param ILiteral|IParameter|IQueryFunction|string $x Field in string format to be inspected by NOT LIKE() comparison.
313314
* @param mixed $y Argument to be used in NOT LIKE() comparison.
314315
* @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
315316
* required when comparing text fields for oci compatibility
@@ -325,8 +326,8 @@ public function notLike($x, $y, $type = null) {
325326
/**
326327
* Creates a IN () comparison expression with the given arguments.
327328
*
328-
* @param string $x The field in string format to be inspected by IN() comparison.
329-
* @param string|array $y The placeholder or the array of values to be used by IN() comparison.
329+
* @param ILiteral|IParameter|IQueryFunction|string $x The field in string format to be inspected by IN() comparison.
330+
* @param ILiteral|IParameter|IQueryFunction|string|array $y The placeholder or the array of values to be used by IN() comparison.
330331
* @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
331332
* required when comparing text fields for oci compatibility
332333
*
@@ -341,8 +342,8 @@ public function in($x, $y, $type = null) {
341342
/**
342343
* Creates a NOT IN () comparison expression with the given arguments.
343344
*
344-
* @param string $x The field in string format to be inspected by NOT IN() comparison.
345-
* @param string|array $y The placeholder or the array of values to be used by NOT IN() comparison.
345+
* @param ILiteral|IParameter|IQueryFunction|string $x The field in string format to be inspected by NOT IN() comparison.
346+
* @param ILiteral|IParameter|IQueryFunction|string|array $y The placeholder or the array of values to be used by NOT IN() comparison.
346347
* @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
347348
* required when comparing text fields for oci compatibility
348349
*

lib/private/DB/QueryBuilder/QueryBuilder.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
use OC\DB\QueryBuilder\FunctionBuilder\PgSqlFunctionBuilder;
4343
use OC\DB\QueryBuilder\FunctionBuilder\SqliteFunctionBuilder;
4444
use OC\SystemConfig;
45+
use OCP\DB\QueryBuilder\ILiteral;
4546
use OCP\DB\QueryBuilder\IParameter;
4647
use OCP\DB\QueryBuilder\IQueryBuilder;
4748
use OCP\DB\QueryBuilder\IQueryFunction;
@@ -695,7 +696,7 @@ public function rightJoin($fromAlias, $join, $alias, $condition = null) {
695696
* </code>
696697
*
697698
* @param string $key The column to set.
698-
* @param IParameter|string $value The value, expression, placeholder, etc.
699+
* @param ILiteral|IParameter|IQueryFunction|string $value The value, expression, placeholder, etc.
699700
*
700701
* @return $this This QueryBuilder instance.
701702
*/
@@ -868,14 +869,14 @@ public function addGroupBy(...$groupBys) {
868869
* </code>
869870
*
870871
* @param string $column The column into which the value should be inserted.
871-
* @param string $value The value that should be inserted into the column.
872+
* @param IParameter|string $value The value that should be inserted into the column.
872873
*
873874
* @return $this This QueryBuilder instance.
874875
*/
875876
public function setValue($column, $value) {
876877
$this->queryBuilder->setValue(
877878
$this->helper->quoteColumnName($column),
878-
$value
879+
(string) $value
879880
);
880881

881882
return $this;

lib/public/DB/QueryBuilder/IExpressionBuilder.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ public function isNotNull($x);
244244
/**
245245
* Creates a LIKE() comparison expression with the given arguments.
246246
*
247-
* @param string $x Field in string format to be inspected by LIKE() comparison.
247+
* @param ILiteral|IParameter|IQueryFunction|string $x Field in string format to be inspected by LIKE() comparison.
248248
* @param mixed $y Argument to be used in LIKE() comparison.
249249
* @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
250250
* required when comparing text fields for oci compatibility
@@ -257,7 +257,7 @@ public function like($x, $y, $type = null);
257257
/**
258258
* Creates a NOT LIKE() comparison expression with the given arguments.
259259
*
260-
* @param string $x Field in string format to be inspected by NOT LIKE() comparison.
260+
* @param ILiteral|IParameter|IQueryFunction|string $x Field in string format to be inspected by NOT LIKE() comparison.
261261
* @param mixed $y Argument to be used in NOT LIKE() comparison.
262262
* @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
263263
* required when comparing text fields for oci compatibility
@@ -283,8 +283,8 @@ public function iLike($x, $y, $type = null);
283283
/**
284284
* Creates a IN () comparison expression with the given arguments.
285285
*
286-
* @param string $x The field in string format to be inspected by IN() comparison.
287-
* @param string|array $y The placeholder or the array of values to be used by IN() comparison.
286+
* @param ILiteral|IParameter|IQueryFunction|string $x The field in string format to be inspected by IN() comparison.
287+
* @param ILiteral|IParameter|IQueryFunction|string|array $y The placeholder or the array of values to be used by IN() comparison.
288288
* @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
289289
* required when comparing text fields for oci compatibility
290290
*
@@ -296,8 +296,8 @@ public function in($x, $y, $type = null);
296296
/**
297297
* Creates a NOT IN () comparison expression with the given arguments.
298298
*
299-
* @param string $x The field in string format to be inspected by NOT IN() comparison.
300-
* @param string|array $y The placeholder or the array of values to be used by NOT IN() comparison.
299+
* @param ILiteral|IParameter|IQueryFunction|string $x The field in string format to be inspected by NOT IN() comparison.
300+
* @param ILiteral|IParameter|IQueryFunction|string|array $y The placeholder or the array of values to be used by NOT IN() comparison.
301301
* @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
302302
* required when comparing text fields for oci compatibility
303303
*

lib/public/DB/QueryBuilder/IQueryBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ public function rightJoin($fromAlias, $join, $alias, $condition = null);
522522
* </code>
523523
*
524524
* @param string $key The column to set.
525-
* @param IParameter|string $value The value, expression, placeholder, etc.
525+
* @param ILiteral|IParameter|IQueryFunction|string $value The value, expression, placeholder, etc.
526526
*
527527
* @return $this This QueryBuilder instance.
528528
* @since 8.2.0
@@ -651,7 +651,7 @@ public function addGroupBy(...$groupBy);
651651
* </code>
652652
*
653653
* @param string $column The column into which the value should be inserted.
654-
* @param string $value The value that should be inserted into the column.
654+
* @param IParameter|string $value The value that should be inserted into the column.
655655
*
656656
* @return $this This QueryBuilder instance.
657657
* @since 8.2.0

0 commit comments

Comments
 (0)