Skip to content

Commit eb3dbc4

Browse files
Merge pull request #19585 from kamil-tekiela/Minor-fixes
Minor fixes
2 parents 81a057a + 265f672 commit eb3dbc4

File tree

3 files changed

+12
-67
lines changed

3 files changed

+12
-67
lines changed

phpstan-baseline.neon

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6474,12 +6474,6 @@ parameters:
64746474
count: 2
64756475
path: src/Display/Results.php
64766476

6477-
-
6478-
message: '#^Offset 3 does not exist on array\{string\|null, string\|null, string\|null\}\.$#'
6479-
identifier: offsetAccess.notFound
6480-
count: 1
6481-
path: src/Display/Results.php
6482-
64836477
-
64846478
message: '#^Only booleans are allowed in &&, array\<mixed\>\|bool given on the left side\.$#'
64856479
identifier: booleanAnd.leftNotBoolean

psalm-baseline.xml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4023,15 +4023,6 @@
40234023
<code><![CDATA[$linkingUrlParams]]></code>
40244024
<code><![CDATA[$sortExpressionNoDirection]]></code>
40254025
</InvalidArgument>
4026-
<InvalidArrayOffset>
4027-
<code><![CDATA[$delUrlParams]]></code>
4028-
</InvalidArrayOffset>
4029-
<InvalidReturnStatement>
4030-
<code><![CDATA[[$deleteUrl, $deleteString, $jsConf, $urlParams]]]></code>
4031-
</InvalidReturnStatement>
4032-
<InvalidReturnType>
4033-
<code><![CDATA[array{?string, ?string, ?string}]]></code>
4034-
</InvalidReturnType>
40354026
<MixedArgument>
40364027
<code><![CDATA[$_SESSION['tmpval']['max_rows']]]></code>
40374028
<code><![CDATA[$_SESSION['tmpval']['pos'] / $_SESSION['tmpval']['max_rows']]]></code>
@@ -4221,14 +4212,6 @@
42214212
<code><![CDATA[$this->numRows > 0 ? $this->numRows - 1 : 0]]></code>
42224213
<code><![CDATA[$this->numRows > 0 ? $this->numRows - 1 : 0]]></code>
42234214
</PossiblyInvalidArgument>
4224-
<PossiblyInvalidOperand>
4225-
<code><![CDATA[$editCopyUrlParams]]></code>
4226-
<code><![CDATA[$editCopyUrlParams]]></code>
4227-
<code><![CDATA[$editCopyUrlParams]]></code>
4228-
<code><![CDATA[$editCopyUrlParams]]></code>
4229-
<code><![CDATA[$editCopyUrlParams]]></code>
4230-
<code><![CDATA[$editCopyUrlParams]]></code>
4231-
</PossiblyInvalidOperand>
42324215
<PossiblyNullArgument>
42334216
<code><![CDATA[$oneKey->refTableName]]></code>
42344217
<code><![CDATA[$statementInfo->parser->list]]></code>

src/Display/Results.php

Lines changed: 12 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -484,12 +484,11 @@ private function setDisplayPartsForSelect(DisplayParts $displayParts): DisplayPa
484484
*
485485
* @see getTable()
486486
*
487-
* @return array<int, DisplayParts|int|mixed> the first element is a {@see DisplayParts} object
487+
* @return array{DisplayParts, int} the first element is a {@see DisplayParts} object
488488
* the second element is the total number of rows returned
489489
* by the SQL query without any programmatically appended
490490
* LIMIT clause (just a copy of $unlim_num_rows if it exists,
491491
* else computed inside this function)
492-
* @psalm-return array{DisplayParts, int}
493492
*/
494493
private function setDisplayPartsAndTotal(DisplayParts $displayParts): array
495494
{
@@ -1875,13 +1874,11 @@ private function getTableBody(
18751874

18761875
// 1.2.1 Modify link(s) - update row case
18771876
if ($displayParts->hasEditLink) {
1878-
[
1879-
$editUrl,
1880-
$copyUrl,
1881-
$editString,
1882-
$copyString,
1883-
$editCopyUrlParams,
1884-
] = $this->getModifiedLinks($whereClause, $clauseIsUnique, $urlSqlQuery);
1877+
$editCopyUrlParams = $this->getUrlParams($whereClause, $clauseIsUnique, $urlSqlQuery);
1878+
$editUrl = Url::getFromRoute('/table/change');
1879+
$copyUrl = Url::getFromRoute('/table/change');
1880+
$editString = $this->getActionLinkContent('b_edit', __('Edit'));
1881+
$copyString = $this->getActionLinkContent('b_insrow', __('Copy'));
18851882
}
18861883

18871884
// 1.2.2 Delete/Kill link(s)
@@ -2440,23 +2437,10 @@ private function getRepeatingHeaders(): string
24402437
return $headerHtml;
24412438
}
24422439

2443-
/**
2444-
* Get modified links
2445-
*
2446-
* @see getTableBody()
2447-
*
2448-
* @param string $whereClause the where clause of the sql
2449-
* @param bool $clauseIsUnique the unique condition of clause
2450-
* @param string $urlSqlQuery the analyzed sql query
2451-
*
2452-
* @return array<int,string|array<string, bool|string>>
2453-
*/
2454-
private function getModifiedLinks(
2455-
string $whereClause,
2456-
bool $clauseIsUnique,
2457-
string $urlSqlQuery,
2458-
): array {
2459-
$urlParams = [
2440+
/** @return (string|bool)[] */
2441+
private function getUrlParams(string $whereClause, bool $clauseIsUnique, string $urlSqlQuery): array
2442+
{
2443+
return [
24602444
'db' => $this->db,
24612445
'table' => $this->table,
24622446
'where_clause' => $whereClause,
@@ -2466,21 +2450,6 @@ private function getModifiedLinks(
24662450
'sql_signature' => Core::signSqlQuery($urlSqlQuery),
24672451
'goto' => Url::getFromRoute('/sql'),
24682452
];
2469-
2470-
$editUrl = Url::getFromRoute('/table/change');
2471-
2472-
$copyUrl = Url::getFromRoute('/table/change');
2473-
2474-
$editStr = $this->getActionLinkContent(
2475-
'b_edit',
2476-
__('Edit'),
2477-
);
2478-
$copyStr = $this->getActionLinkContent(
2479-
'b_insrow',
2480-
__('Copy'),
2481-
);
2482-
2483-
return [$editUrl, $copyUrl, $editStr, $copyStr, $urlParams];
24842453
}
24852454

24862455
/**
@@ -2493,8 +2462,7 @@ private function getModifiedLinks(
24932462
* @param string $urlSqlQuery the analyzed sql query
24942463
* @param int $processId Process ID
24952464
*
2496-
* @return mixed[] $del_url, $del_str, $js_conf
2497-
* @psalm-return array{?string, ?string, ?string}
2465+
* @return array{?string, ?string, ?string, string[]|null}
24982466
*/
24992467
private function getDeleteAndKillLinks(
25002468
string $whereClause,
@@ -2563,7 +2531,7 @@ private function getDeleteAndKillLinks(
25632531
/**
25642532
* Get content inside the table row action links (Edit/Copy/Delete)
25652533
*
2566-
* @see getModifiedLinks(), getDeleteAndKillLinks()
2534+
* @see getDeleteAndKillLinks()
25672535
*
25682536
* @param string $icon The name of the file to get
25692537
* @param string $displayText The text displaying after the image icon

0 commit comments

Comments
 (0)