Table small fixes (#18405)

* Replace isset with null coalesce

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Remove @var annotation

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Remove unused argument

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Update baselines

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

---------

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
This commit is contained in:
Kamil Tekiela 2023-05-12 17:47:21 +01:00 committed by GitHub
parent 5137d5711e
commit 0d13a6bfad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 23 deletions

View File

@ -958,11 +958,8 @@ class Table implements Stringable
/**
* The full name of source table, quoted.
*
* @var string $source
*/
$source = Util::backquote($sourceDb)
. '.' . Util::backquote($sourceTable);
$source = Util::backquote($sourceDb) . '.' . Util::backquote($sourceTable);
// If the target database is not specified, the operation is taking
// place in the same database.
@ -976,11 +973,8 @@ class Table implements Stringable
/**
* The full name of target table, quoted.
*
* @var string $target
*/
$target = Util::backquote($targetDb)
. '.' . Util::backquote($targetTable);
$target = Util::backquote($targetDb) . '.' . Util::backquote($targetTable);
// No table is created when this is a data-only operation.
if ($what !== 'dataonly') {
@ -1207,8 +1201,8 @@ class Table implements Stringable
$GLOBALS['sql_query'] .= "\n\n" . $sqlSetMode . ';';
$oldTable = new Table($sourceTable, $sourceDb, $GLOBALS['dbi']);
$nonGeneratedCols = $oldTable->getNonGeneratedColumns(true);
if (count($nonGeneratedCols) > 0) {
$nonGeneratedCols = $oldTable->getNonGeneratedColumns();
if ($nonGeneratedCols !== []) {
$sqlInsertData = 'INSERT INTO ' . $target . '('
. implode(', ', $nonGeneratedCols)
. ') SELECT ' . implode(', ', $nonGeneratedCols)
@ -2201,11 +2195,7 @@ class Table implements Stringable
$foreignTable = $destinationForeignTable[$masterFieldMd5];
$foreignField = $destinationForeignColumn[$masterFieldMd5];
if (isset($existrelForeign[$masterFieldMd5]['ref_db_name'])) {
$refDbName = $existrelForeign[$masterFieldMd5]['ref_db_name'];
} else {
$refDbName = $GLOBALS['db'];
}
$refDbName = $existrelForeign[$masterFieldMd5]['ref_db_name'] ?? $GLOBALS['db'];
$emptyFields = false;
foreach ($masterField as $key => $oneField) {

View File

@ -8332,7 +8332,7 @@ parameters:
-
message: "#^Cannot access offset 'ref_db_name' on mixed\\.$#"
count: 3
count: 2
path: libraries/classes/Table.php
-

View File

@ -12917,6 +12917,7 @@
<code><![CDATA[$existrelForeign[$masterFieldMd5]['on_update']]]></code>
<code><![CDATA[$existrelForeign[$masterFieldMd5]['on_update']]]></code>
<code><![CDATA[$existrelForeign[$masterFieldMd5]['ref_db_name']]]></code>
<code><![CDATA[$existrelForeign[$masterFieldMd5]['ref_db_name']]]></code>
<code><![CDATA[$existrelForeign[$masterFieldMd5]['ref_index_list']]]></code>
<code><![CDATA[$existrelForeign[$masterFieldMd5]['ref_index_list']]]></code>
<code><![CDATA[$existrelForeign[$masterFieldMd5]['ref_table_name']]]></code>
@ -13095,15 +13096,10 @@
<code><![CDATA[Generator::mysqlDie($tmpErrorCreate, $createQuery, false, '', false)]]></code>
<code><![CDATA[Generator::mysqlDie($tmpErrorDrop, $dropQuery, false, '', false)]]></code>
</PossiblyNullOperand>
<PossiblyNullReference>
<PossiblyUndefinedArrayOffset>
<code>$existrelForeign[$masterFieldMd5]</code>
<code>$existrelForeign[$masterFieldMd5]</code>
<code>$existrelForeign[$masterFieldMd5]</code>
<code>$existrelForeign[$masterFieldMd5]</code>
<code>$existrelForeign[$masterFieldMd5]</code>
<code>$existrelForeign[$masterFieldMd5]</code>
<code>$existrelForeign[$masterFieldMd5]</code>
</PossiblyNullReference>
</PossiblyUndefinedArrayOffset>
<PossiblyUnusedProperty>
<code>$engine</code>
<code>$type</code>