Remove getWhereClauseArray()
This weird array cast is not adding anything useful. The psalm type hint tells us that elements are strings, but that's not guaranteed in any way. Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
This commit is contained in:
parent
a2a35c19de
commit
0bb63c997f
@ -132,26 +132,6 @@ class InsertEdit
|
||||
return $formParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates array of where clauses
|
||||
*
|
||||
* @param string[]|string|null $whereClause where clause
|
||||
*
|
||||
* @return string[] whereClauseArray array of where clauses
|
||||
*/
|
||||
private function getWhereClauseArray(array|string|null $whereClause): array
|
||||
{
|
||||
if ($whereClause === null) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (is_array($whereClause)) {
|
||||
return $whereClause;
|
||||
}
|
||||
|
||||
return [$whereClause];
|
||||
}
|
||||
|
||||
/**
|
||||
* Analysing where clauses array
|
||||
*
|
||||
@ -1757,7 +1737,7 @@ class InsertEdit
|
||||
if (isset($whereClause)) {
|
||||
// we are editing
|
||||
$insertMode = false;
|
||||
$whereClauseArray = $this->getWhereClauseArray($whereClause);
|
||||
$whereClauseArray = (array) $whereClause;
|
||||
[$whereClauses, $result, $rows, $foundUniqueKey] = $this->analyzeWhereClauses(
|
||||
$whereClauseArray,
|
||||
$table,
|
||||
|
||||
@ -7981,7 +7981,6 @@
|
||||
<code>$whereClause</code>
|
||||
<code>$whereClause</code>
|
||||
<code>$whereClause</code>
|
||||
<code>$whereClause</code>
|
||||
<code><![CDATA[min(max($column['len'], 4), $GLOBALS['cfg']['LimitChars'])]]></code>
|
||||
</MixedArgument>
|
||||
<MixedArgumentTypeCoercion>
|
||||
@ -7991,6 +7990,7 @@
|
||||
<code>$thisUrlParams</code>
|
||||
<code>$urlParams</code>
|
||||
<code>$valueSets</code>
|
||||
<code>$whereClauseArray</code>
|
||||
</MixedArgumentTypeCoercion>
|
||||
<MixedArrayAccess>
|
||||
<code><![CDATA[$_SESSION['tmpval']['relational_display']]]></code>
|
||||
@ -8093,7 +8093,6 @@
|
||||
<code><![CDATA[$_GET['sql_query']]]></code>
|
||||
<code><![CDATA[$_GET['sql_signature']]]></code>
|
||||
<code>$whereClause</code>
|
||||
<code>$whereClause</code>
|
||||
</PossiblyInvalidArgument>
|
||||
<PossiblyInvalidArrayOffset>
|
||||
<code><![CDATA[$_POST['fields']['multi_edit']]]></code>
|
||||
|
||||
@ -181,42 +181,6 @@ class InsertEditTest extends AbstractTestCase
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for getWhereClauseArray
|
||||
*/
|
||||
public function testGetWhereClauseArray(): void
|
||||
{
|
||||
$this->assertEquals(
|
||||
[],
|
||||
$this->callFunction(
|
||||
$this->insertEdit,
|
||||
InsertEdit::class,
|
||||
'getWhereClauseArray',
|
||||
[null],
|
||||
),
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
[1, 2, 3],
|
||||
$this->callFunction(
|
||||
$this->insertEdit,
|
||||
InsertEdit::class,
|
||||
'getWhereClauseArray',
|
||||
[[1, 2, 3]],
|
||||
),
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
['clause'],
|
||||
$this->callFunction(
|
||||
$this->insertEdit,
|
||||
InsertEdit::class,
|
||||
'getWhereClauseArray',
|
||||
['clause'],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for analyzeWhereClauses
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user