Merge pull request #18424 from kamil-tekiela/Unused-params

Remove unused params
This commit is contained in:
Maurício Meneghini Fauth 2023-05-18 20:30:57 -03:00 committed by GitHub
commit e1398f3402
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 64 additions and 167 deletions

View File

@ -111,7 +111,6 @@ class DesignerController extends AbstractController
$this->response->addJSON('message', $GLOBALS['message']);
} elseif ($operation === 'addNewRelation') {
[$success, $GLOBALS['message']] = $this->designerCommon->addNewRelation(
$db,
$request->getParsedBodyParam('T1'),
$request->getParsedBodyParam('F1'),
$request->getParsedBodyParam('T2'),

View File

@ -489,7 +489,6 @@ class Common
/**
* Adds a new foreign relation
*
* @param string $db database name
* @param string $t1 foreign table
* @param string $f1 foreign field
* @param string $t2 master table
@ -503,7 +502,6 @@ class Common
* @psalm-return array{0: bool, 1: string}
*/
public function addNewRelation(
string $db,
string $t1,
string $f1,
string $t2,

View File

@ -317,7 +317,6 @@ class ExportHtmlword extends ExportPlugin
* export types which use this parameter
* @param bool $doMime whether to include mime comments
* at the end
* @param bool $view whether we're handling a view
* @param mixed[] $aliases Aliases of db/table/columns
*
* @return string resulting schema
@ -328,7 +327,6 @@ class ExportHtmlword extends ExportPlugin
bool $doRelation,
bool $doComments,
bool $doMime,
bool $view = false,
array $aliases = [],
): string {
$relationParameters = $this->relation->getRelationParameters();
@ -532,7 +530,7 @@ class ExportHtmlword extends ExportPlugin
. __('Table structure for table') . ' '
. htmlspecialchars($tableAlias)
. '</h2>';
$dump .= $this->getTableDef($db, $table, $doRelation, $doComments, $doMime, false, $aliases);
$dump .= $this->getTableDef($db, $table, $doRelation, $doComments, $doMime, $aliases);
break;
case 'triggers':
$triggers = Triggers::getDetails($GLOBALS['dbi'], $db, $table);
@ -548,7 +546,7 @@ class ExportHtmlword extends ExportPlugin
$dump .= '<h2>'
. __('Structure for view') . ' ' . htmlspecialchars($tableAlias)
. '</h2>';
$dump .= $this->getTableDef($db, $table, $doRelation, $doComments, $doMime, true, $aliases);
$dump .= $this->getTableDef($db, $table, $doRelation, $doComments, $doMime, $aliases);
break;
case 'stand_in':
$dump .= '<h2>'

View File

@ -387,32 +387,24 @@ class ExportOdt extends ExportPlugin
/**
* Returns $table's CREATE definition
*
* @param string $db the database name
* @param string $table the table name
* @param string $errorUrl the url to go back in case of error
* @param bool $doRelation whether to include relation comments
* @param bool $doComments whether to include the pmadb-style column
* comments as comments in the structure;
* this is deprecated but the parameter is
* left here because /export calls
* PMA_exportStructure() also for other
* @param bool $doMime whether to include mime comments
* @param bool $showDates whether to include creation/update/check dates
* @param bool $addSemicolon whether to add semicolon and end-of-line at
* the end
* @param bool $view whether we're handling a view
* @param mixed[] $aliases Aliases of db/table/columns
* @param string $db the database name
* @param string $table the table name
* @param bool $doRelation whether to include relation comments
* @param bool $doComments whether to include the pmadb-style column
* comments as comments in the structure;
* this is deprecated but the parameter is
* left here because /export calls
* PMA_exportStructure() also for other
* @param bool $doMime whether to include mime comments
* the end
* @param mixed[] $aliases Aliases of db/table/columns
*/
public function getTableDef(
string $db,
string $table,
string $errorUrl,
bool $doRelation,
bool $doComments,
bool $doMime,
bool $showDates = false,
bool $addSemicolon = true,
bool $view = false,
array $aliases = [],
): bool {
$dbAlias = $db;
@ -660,18 +652,7 @@ class ExportOdt extends ExportPlugin
. __('Table structure for table') . ' ' .
htmlspecialchars($tableAlias)
. '</text:h>';
$this->getTableDef(
$db,
$table,
$errorUrl,
$doRelation,
$doComments,
$doMime,
$dates,
true,
false,
$aliases,
);
$this->getTableDef($db, $table, $doRelation, $doComments, $doMime, $aliases);
break;
case 'triggers':
$triggers = Triggers::getDetails($GLOBALS['dbi'], $db, $table);
@ -691,18 +672,7 @@ class ExportOdt extends ExportPlugin
. __('Structure for view') . ' '
. htmlspecialchars($tableAlias)
. '</text:h>';
$this->getTableDef(
$db,
$table,
$errorUrl,
$doRelation,
$doComments,
$doMime,
$dates,
true,
true,
$aliases,
);
$this->getTableDef($db, $table, $doRelation, $doComments, $doMime, $aliases);
break;
case 'stand_in':
$GLOBALS['odt_buffer'] .= '<text:h text:outline-level="2" text:style-name="Heading_2"'

View File

@ -272,13 +272,13 @@ class ExportPdf extends ExportPlugin
*/
switch ($exportMode) {
case 'create_table':
$pdf->getTableDef($db, $table, $doRelation, true, $doMime, false, $aliases);
$pdf->getTableDef($db, $table, $doRelation, true, $doMime);
break;
case 'triggers':
$pdf->getTriggers($db, $table);
break;
case 'create_view':
$pdf->getTableDef($db, $table, $doRelation, true, $doMime, false, $aliases);
$pdf->getTableDef($db, $table, $doRelation, true, $doMime);
break;
case 'stand_in':
// export a stand-in definition to resolve view dependencies

View File

@ -305,35 +305,27 @@ class ExportTexytext extends ExportPlugin
/**
* Returns $table's CREATE definition
*
* @param string $db the database name
* @param string $table the table name
* @param string $errorUrl the url to go back in case of error
* @param bool $doRelation whether to include relation comments
* @param bool $doComments whether to include the pmadb-style column
* comments as comments in the structure;
* this is deprecated but the parameter is
* left here because /export calls
* $this->exportStructure() also for other
* export types which use this parameter
* @param bool $doMime whether to include mime comments
* @param bool $showDates whether to include creation/update/check dates
* @param bool $addSemicolon whether to add semicolon and end-of-line
* at the end
* @param bool $view whether we're handling a view
* @param mixed[] $aliases Aliases of db/table/columns
* @param string $db the database name
* @param string $table the table name
* @param bool $doRelation whether to include relation comments
* @param bool $doComments whether to include the pmadb-style column
* comments as comments in the structure;
* this is deprecated but the parameter is
* left here because /export calls
* $this->exportStructure() also for other
* export types which use this parameter
* @param bool $doMime whether to include mime comments
* at the end
* @param mixed[] $aliases Aliases of db/table/columns
*
* @return string resulting schema
*/
public function getTableDef(
string $db,
string $table,
string $errorUrl,
bool $doRelation,
bool $doComments,
bool $doMime,
bool $showDates = false,
bool $addSemicolon = true,
bool $view = false,
array $aliases = [],
): string {
$relationParameters = $this->relation->getRelationParameters();
@ -503,18 +495,7 @@ class ExportTexytext extends ExportPlugin
case 'create_table':
$dump .= '== ' . __('Table structure for table') . ' '
. $tableAlias . "\n\n";
$dump .= $this->getTableDef(
$db,
$table,
$errorUrl,
$doRelation,
$doComments,
$doMime,
$dates,
true,
false,
$aliases,
);
$dump .= $this->getTableDef($db, $table, $doRelation, $doComments, $doMime, $aliases);
break;
case 'triggers':
$triggers = Triggers::getDetails($GLOBALS['dbi'], $db, $table);
@ -526,18 +507,7 @@ class ExportTexytext extends ExportPlugin
break;
case 'create_view':
$dump .= '== ' . __('Structure for view') . ' ' . $tableAlias . "\n\n";
$dump .= $this->getTableDef(
$db,
$table,
$errorUrl,
$doRelation,
$doComments,
$doMime,
$dates,
true,
true,
$aliases,
);
$dump .= $this->getTableDef($db, $table, $doRelation, $doComments, $doMime, $aliases);
break;
case 'stand_in':
$dump .= '== ' . __('Stand-in structure for view')

View File

@ -431,18 +431,16 @@ class Pdf extends PdfLib
/**
* Print $table's CREATE definition
*
* @param string $db the database name
* @param string $table the table name
* @param bool $doRelation whether to include relation comments
* @param bool $doComments whether to include the pmadb-style column
* comments as comments in the structure;
* this is deprecated but the parameter is
* left here because /export calls
* PMA_exportStructure() also for other
* export types which use this parameter
* @param bool $doMime whether to include mime comments
* @param bool $view whether we're handling a view
* @param mixed[] $aliases aliases of db/table/columns
* @param string $db the database name
* @param string $table the table name
* @param bool $doRelation whether to include relation comments
* @param bool $doComments whether to include the pmadb-style column
* comments as comments in the structure;
* this is deprecated but the parameter is
* left here because /export calls
* PMA_exportStructure() also for other
* export types which use this parameter
* @param bool $doMime whether to include mime comments
*/
public function getTableDef(
string $db,
@ -450,8 +448,6 @@ class Pdf extends PdfLib
bool $doRelation,
bool $doComments,
bool $doMime,
bool $view = false,
array $aliases = [],
): void {
$relationParameters = $this->relation->getRelationParameters();

View File

@ -197,11 +197,10 @@ class ZipExtension
*
* @param mixed[]|string $data contents of the file/files
* @param mixed[]|string $name name of the file/files in the archive
* @param int $time the current timestamp
*
* @return string|false the ZIP file contents, or false if there was an error.
*/
public function createFile(array|string $data, array|string $name, int $time = 0): string|false
public function createFile(array|string $data, array|string $name): string|false
{
$datasec = []; // Array to store compressed data
$ctrlDir = []; // Central directory

View File

@ -825,11 +825,6 @@ parameters:
count: 1
path: libraries/classes/Controllers/Database/DesignerController.php
-
message: "#^Parameter \\#1 \\$db of method PhpMyAdmin\\\\Database\\\\Designer\\\\Common\\:\\:addNewRelation\\(\\) expects string, mixed given\\.$#"
count: 1
path: libraries/classes/Controllers/Database/DesignerController.php
-
message: "#^Parameter \\#1 \\$db of method PhpMyAdmin\\\\Database\\\\Designer\\\\Common\\:\\:getDefaultPage\\(\\) expects string, mixed given\\.$#"
count: 1
@ -885,6 +880,11 @@ parameters:
count: 1
path: libraries/classes/Controllers/Database/DesignerController.php
-
message: "#^Parameter \\#1 \\$t1 of method PhpMyAdmin\\\\Database\\\\Designer\\\\Common\\:\\:addNewRelation\\(\\) expects string, mixed given\\.$#"
count: 1
path: libraries/classes/Controllers/Database/DesignerController.php
-
message: "#^Parameter \\#1 \\$t1 of method PhpMyAdmin\\\\Database\\\\Designer\\\\Common\\:\\:removeRelation\\(\\) expects string, mixed given\\.$#"
count: 1
@ -895,6 +895,11 @@ parameters:
count: 1
path: libraries/classes/Controllers/Database/DesignerController.php
-
message: "#^Parameter \\#2 \\$f1 of method PhpMyAdmin\\\\Database\\\\Designer\\\\Common\\:\\:addNewRelation\\(\\) expects string, mixed given\\.$#"
count: 1
path: libraries/classes/Controllers/Database/DesignerController.php
-
message: "#^Parameter \\#2 \\$f1 of method PhpMyAdmin\\\\Database\\\\Designer\\\\Common\\:\\:removeRelation\\(\\) expects string, mixed given\\.$#"
count: 1
@ -910,11 +915,6 @@ parameters:
count: 1
path: libraries/classes/Controllers/Database/DesignerController.php
-
message: "#^Parameter \\#2 \\$t1 of method PhpMyAdmin\\\\Database\\\\Designer\\\\Common\\:\\:addNewRelation\\(\\) expects string, mixed given\\.$#"
count: 1
path: libraries/classes/Controllers/Database/DesignerController.php
-
message: "#^Parameter \\#2 \\$table of method PhpMyAdmin\\\\Database\\\\Designer\\\\Common\\:\\:getTablesInfo\\(\\) expects string\\|null, mixed given\\.$#"
count: 2
@ -931,12 +931,12 @@ parameters:
path: libraries/classes/Controllers/Database/DesignerController.php
-
message: "#^Parameter \\#3 \\$f1 of method PhpMyAdmin\\\\Database\\\\Designer\\\\Common\\:\\:addNewRelation\\(\\) expects string, mixed given\\.$#"
message: "#^Parameter \\#3 \\$field of method PhpMyAdmin\\\\Database\\\\Designer\\\\Common\\:\\:saveDisplayField\\(\\) expects string, mixed given\\.$#"
count: 1
path: libraries/classes/Controllers/Database/DesignerController.php
-
message: "#^Parameter \\#3 \\$field of method PhpMyAdmin\\\\Database\\\\Designer\\\\Common\\:\\:saveDisplayField\\(\\) expects string, mixed given\\.$#"
message: "#^Parameter \\#3 \\$t2 of method PhpMyAdmin\\\\Database\\\\Designer\\\\Common\\:\\:addNewRelation\\(\\) expects string, mixed given\\.$#"
count: 1
path: libraries/classes/Controllers/Database/DesignerController.php
@ -945,38 +945,33 @@ parameters:
count: 1
path: libraries/classes/Controllers/Database/DesignerController.php
-
message: "#^Parameter \\#4 \\$f2 of method PhpMyAdmin\\\\Database\\\\Designer\\\\Common\\:\\:addNewRelation\\(\\) expects string, mixed given\\.$#"
count: 1
path: libraries/classes/Controllers/Database/DesignerController.php
-
message: "#^Parameter \\#4 \\$f2 of method PhpMyAdmin\\\\Database\\\\Designer\\\\Common\\:\\:removeRelation\\(\\) expects string, mixed given\\.$#"
count: 1
path: libraries/classes/Controllers/Database/DesignerController.php
-
message: "#^Parameter \\#4 \\$t2 of method PhpMyAdmin\\\\Database\\\\Designer\\\\Common\\:\\:addNewRelation\\(\\) expects string, mixed given\\.$#"
message: "#^Parameter \\#5 \\$onDelete of method PhpMyAdmin\\\\Database\\\\Designer\\\\Common\\:\\:addNewRelation\\(\\) expects string, mixed given\\.$#"
count: 1
path: libraries/classes/Controllers/Database/DesignerController.php
-
message: "#^Parameter \\#5 \\$f2 of method PhpMyAdmin\\\\Database\\\\Designer\\\\Common\\:\\:addNewRelation\\(\\) expects string, mixed given\\.$#"
message: "#^Parameter \\#6 \\$onUpdate of method PhpMyAdmin\\\\Database\\\\Designer\\\\Common\\:\\:addNewRelation\\(\\) expects string, mixed given\\.$#"
count: 1
path: libraries/classes/Controllers/Database/DesignerController.php
-
message: "#^Parameter \\#6 \\$onDelete of method PhpMyAdmin\\\\Database\\\\Designer\\\\Common\\:\\:addNewRelation\\(\\) expects string, mixed given\\.$#"
message: "#^Parameter \\#7 \\$db1 of method PhpMyAdmin\\\\Database\\\\Designer\\\\Common\\:\\:addNewRelation\\(\\) expects string, mixed given\\.$#"
count: 1
path: libraries/classes/Controllers/Database/DesignerController.php
-
message: "#^Parameter \\#7 \\$onUpdate of method PhpMyAdmin\\\\Database\\\\Designer\\\\Common\\:\\:addNewRelation\\(\\) expects string, mixed given\\.$#"
count: 1
path: libraries/classes/Controllers/Database/DesignerController.php
-
message: "#^Parameter \\#8 \\$db1 of method PhpMyAdmin\\\\Database\\\\Designer\\\\Common\\:\\:addNewRelation\\(\\) expects string, mixed given\\.$#"
count: 1
path: libraries/classes/Controllers/Database/DesignerController.php
-
message: "#^Parameter \\#9 \\$db2 of method PhpMyAdmin\\\\Database\\\\Designer\\\\Common\\:\\:addNewRelation\\(\\) expects string, mixed given\\.$#"
message: "#^Parameter \\#8 \\$db2 of method PhpMyAdmin\\\\Database\\\\Designer\\\\Common\\:\\:addNewRelation\\(\\) expects string, mixed given\\.$#"
count: 1
path: libraries/classes/Controllers/Database/DesignerController.php

View File

@ -996,7 +996,6 @@
<code>$db</code>
<code>$db</code>
<code>$db</code>
<code>$db</code>
<code>$html</code>
<code>$page</code>
<code><![CDATA[$position['dbName']]]></code>
@ -5142,9 +5141,6 @@
<code>$indexArray1</code>
<code>$indexArray2</code>
</PossiblyNullArrayOffset>
<PossiblyUnusedParam>
<code>$db</code>
</PossiblyUnusedParam>
</file>
<file src="libraries/classes/Database/Designer/DesignerTable.php">
<PossiblyUnusedMethod>
@ -9201,9 +9197,6 @@
<code>$comments</code>
<code>$mimeMap</code>
</PossiblyUndefinedVariable>
<PossiblyUnusedParam>
<code>$view</code>
</PossiblyUnusedParam>
<PossiblyUnusedReturnValue>
<code>bool</code>
</PossiblyUnusedReturnValue>
@ -9428,12 +9421,6 @@
<code><![CDATA[$GLOBALS['plugin_param']['export_type']]]></code>
<code><![CDATA[$GLOBALS['plugin_param']['single_table']]]></code>
</PossiblyNullArrayAccess>
<PossiblyUnusedParam>
<code>$addSemicolon</code>
<code>$errorUrl</code>
<code>$showDates</code>
<code>$view</code>
</PossiblyUnusedParam>
<PossiblyUnusedReturnValue>
<code>string</code>
</PossiblyUnusedReturnValue>
@ -9735,12 +9722,6 @@
<code>$comments</code>
<code>$mimeMap</code>
</PossiblyUndefinedVariable>
<PossiblyUnusedParam>
<code>$addSemicolon</code>
<code>$errorUrl</code>
<code>$showDates</code>
<code>$view</code>
</PossiblyUnusedParam>
</file>
<file src="libraries/classes/Plugins/Export/ExportXml.php">
<InvalidArrayOffset>
@ -10095,10 +10076,6 @@
<code>$resRel</code>
<code>$resRel</code>
</PossiblyUndefinedVariable>
<PossiblyUnusedParam>
<code>$aliases</code>
<code>$view</code>
</PossiblyUnusedParam>
<PropertyNotSetInConstructor>
<code>$results</code>
<code>Pdf</code>
@ -13819,9 +13796,6 @@
<code>$newData[$newName]</code>
<code>$value</code>
</MixedAssignment>
<PossiblyUnusedParam>
<code>$time</code>
</PossiblyUnusedParam>
</file>
<file src="libraries/services_loader.php">
<MixedArgument>

View File

@ -632,7 +632,6 @@ class ExportOdtTest extends AbstractTestCase
$this->object->getTableDef(
'database',
'',
'example.com',
true,
true,
true,
@ -715,7 +714,6 @@ class ExportOdtTest extends AbstractTestCase
$this->object->getTableDef(
'database',
'',
'example.com',
true,
true,
true,

View File

@ -310,7 +310,7 @@ class ExportTexytextTest extends AbstractTestCase
[$GLOBALS['server'] => $relationParameters],
);
$result = $this->object->getTableDef('db', 'table', 'example.com', true, true, true);
$result = $this->object->getTableDef('db', 'table', true, true, true);
$this->assertStringContainsString('1|&lt;ftable (ffield&gt;)|comm|Test&lt;', $result);
}