Merge pull request #19456 from kamil-tekiela/Table-type-hints
Improve Table type hints
This commit is contained in:
commit
c69fa7c85b
@ -4660,7 +4660,7 @@ parameters:
|
||||
path: src/Controllers/Table/RelationController.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#1 \$destinationForeignDb of method PhpMyAdmin\\Table\\Table\:\:updateForeignKeys\(\) expects array\<mixed\>, mixed given\.$#'
|
||||
message: '#^Parameter \#1 \$destinationForeignDb of method PhpMyAdmin\\Table\\Table\:\:updateForeignKeys\(\) expects array\<string\>, mixed given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: src/Controllers/Table/RelationController.php
|
||||
@ -4678,7 +4678,7 @@ parameters:
|
||||
path: src/Controllers/Table/RelationController.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#1 \$multiEditColumnsName of method PhpMyAdmin\\Table\\Table\:\:updateInternalRelations\(\) expects array\<mixed\>, mixed given\.$#'
|
||||
message: '#^Parameter \#1 \$multiEditColumnsName of method PhpMyAdmin\\Table\\Table\:\:updateInternalRelations\(\) expects array\<string\>, mixed given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: src/Controllers/Table/RelationController.php
|
||||
@ -4690,13 +4690,13 @@ parameters:
|
||||
path: src/Controllers/Table/RelationController.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#2 \$destinationDb of method PhpMyAdmin\\Table\\Table\:\:updateInternalRelations\(\) expects array\<mixed\>, mixed given\.$#'
|
||||
message: '#^Parameter \#2 \$destinationDb of method PhpMyAdmin\\Table\\Table\:\:updateInternalRelations\(\) expects array\<string\>, mixed given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: src/Controllers/Table/RelationController.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#2 \$multiEditColumnsName of method PhpMyAdmin\\Table\\Table\:\:updateForeignKeys\(\) expects array\<mixed\>, mixed given\.$#'
|
||||
message: '#^Parameter \#2 \$multiEditColumnsName of method PhpMyAdmin\\Table\\Table\:\:updateForeignKeys\(\) expects array\<array\<string\>\>, mixed given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: src/Controllers/Table/RelationController.php
|
||||
@ -4714,13 +4714,13 @@ parameters:
|
||||
path: src/Controllers/Table/RelationController.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#3 \$destinationForeignTable of method PhpMyAdmin\\Table\\Table\:\:updateForeignKeys\(\) expects array\<mixed\>, mixed given\.$#'
|
||||
message: '#^Parameter \#3 \$destinationForeignTable of method PhpMyAdmin\\Table\\Table\:\:updateForeignKeys\(\) expects array\<string\>, mixed given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: src/Controllers/Table/RelationController.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#3 \$destinationTable of method PhpMyAdmin\\Table\\Table\:\:updateInternalRelations\(\) expects array\<mixed\>, mixed given\.$#'
|
||||
message: '#^Parameter \#3 \$destinationTable of method PhpMyAdmin\\Table\\Table\:\:updateInternalRelations\(\) expects array\<string\|null\>, mixed given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: src/Controllers/Table/RelationController.php
|
||||
@ -4732,13 +4732,13 @@ parameters:
|
||||
path: src/Controllers/Table/RelationController.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#4 \$destinationColumn of method PhpMyAdmin\\Table\\Table\:\:updateInternalRelations\(\) expects array\<mixed\>, mixed given\.$#'
|
||||
message: '#^Parameter \#4 \$destinationColumn of method PhpMyAdmin\\Table\\Table\:\:updateInternalRelations\(\) expects array\<string\|null\>, mixed given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: src/Controllers/Table/RelationController.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#4 \$destinationForeignColumn of method PhpMyAdmin\\Table\\Table\:\:updateForeignKeys\(\) expects array\<mixed\>, mixed given\.$#'
|
||||
message: '#^Parameter \#4 \$destinationForeignColumn of method PhpMyAdmin\\Table\\Table\:\:updateForeignKeys\(\) expects array\<array\<string\>\>, mixed given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: src/Controllers/Table/RelationController.php
|
||||
@ -17133,18 +17133,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/Table/Search.php
|
||||
|
||||
-
|
||||
message: '#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\.$#'
|
||||
identifier: foreach.nonIterable
|
||||
count: 1
|
||||
path: src/Table/Table.php
|
||||
|
||||
-
|
||||
message: '#^Binary operation "\." between string and mixed results in an error\.$#'
|
||||
identifier: binaryOp.invalid
|
||||
count: 1
|
||||
path: src/Table/Table.php
|
||||
|
||||
-
|
||||
message: '#^Binary operation "\.\=" between string and mixed results in an error\.$#'
|
||||
identifier: assignOp.invalid
|
||||
@ -17235,12 +17223,6 @@ parameters:
|
||||
count: 3
|
||||
path: src/Table/Table.php
|
||||
|
||||
-
|
||||
message: '#^Cannot access offset mixed on mixed\.$#'
|
||||
identifier: offsetAccess.nonOffsetAccessible
|
||||
count: 5
|
||||
path: src/Table/Table.php
|
||||
|
||||
-
|
||||
message: '#^Cannot access offset string on mixed\.$#'
|
||||
identifier: offsetAccess.nonOffsetAccessible
|
||||
@ -17283,18 +17265,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/Table/Table.php
|
||||
|
||||
-
|
||||
message: '#^Method PhpMyAdmin\\Table\\Table\:\:getLastError\(\) should return string but returns mixed\.$#'
|
||||
identifier: return.type
|
||||
count: 1
|
||||
path: src/Table/Table.php
|
||||
|
||||
-
|
||||
message: '#^Method PhpMyAdmin\\Table\\Table\:\:getLastMessage\(\) should return string but returns mixed\.$#'
|
||||
identifier: return.type
|
||||
count: 1
|
||||
path: src/Table/Table.php
|
||||
|
||||
-
|
||||
message: '#^Method PhpMyAdmin\\Table\\Table\:\:getNameAndTypeOfTheColumns\(\) should return array\<string, string\> but returns array\.$#'
|
||||
identifier: return.type
|
||||
@ -17346,13 +17316,13 @@ parameters:
|
||||
-
|
||||
message: '#^Parameter \#1 \$identifier of static method PhpMyAdmin\\Util\:\:backquote\(\) expects string\|Stringable\|null, mixed given\.$#'
|
||||
identifier: argument.type
|
||||
count: 5
|
||||
count: 2
|
||||
path: src/Table/Table.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#1 \$str of method PhpMyAdmin\\DatabaseInterface\:\:quoteString\(\) expects string, mixed given\.$#'
|
||||
message: '#^Parameter \#1 \$indexed of method PhpMyAdmin\\Table\\Table\:\:formatColumns\(\) expects array\<string\>, array\<mixed\> given\.$#'
|
||||
identifier: argument.type
|
||||
count: 9
|
||||
count: 2
|
||||
path: src/Table/Table.php
|
||||
|
||||
-
|
||||
@ -17373,18 +17343,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/Table/Table.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#2 \$array of function implode expects array\|null, mixed given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: src/Table/Table.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#2 \$field of method PhpMyAdmin\\Table\\Table\:\:getSQLToCreateForeignKey\(\) expects array\<mixed\>, mixed given\.$#'
|
||||
identifier: argument.type
|
||||
count: 2
|
||||
path: src/Table/Table.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#2 \$string of function explode expects string, mixed given\.$#'
|
||||
identifier: argument.type
|
||||
@ -17397,36 +17355,18 @@ parameters:
|
||||
count: 1
|
||||
path: src/Table/Table.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#3 \$foreignDb of method PhpMyAdmin\\Table\\Table\:\:getSQLToCreateForeignKey\(\) expects string, mixed given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: src/Table/Table.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#3 \$foreignDb of method PhpMyAdmin\\Table\\Table\:\:getSQLToCreateForeignKey\(\) expects string, string\|null given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: src/Table/Table.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#4 \$foreignTable of method PhpMyAdmin\\Table\\Table\:\:getSQLToCreateForeignKey\(\) expects string, mixed given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: src/Table/Table.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#4 \$foreignTable of method PhpMyAdmin\\Table\\Table\:\:getSQLToCreateForeignKey\(\) expects string, string\|null given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: src/Table/Table.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#5 \$foreignField of method PhpMyAdmin\\Table\\Table\:\:getSQLToCreateForeignKey\(\) expects array\<mixed\>, mixed given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: src/Table/Table.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#6 \$name of method PhpMyAdmin\\Table\\Table\:\:getSQLToCreateForeignKey\(\) expects string\|null, mixed given\.$#'
|
||||
identifier: argument.type
|
||||
|
||||
@ -2982,15 +2982,17 @@
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
</DeprecatedMethod>
|
||||
<InvalidArgument>
|
||||
<code><![CDATA[usort($tables, strnatcasecmp(...))]]></code>
|
||||
</InvalidArgument>
|
||||
<PossiblyInvalidArgument>
|
||||
<code><![CDATA[$_POST['destination_column']]]></code>
|
||||
<code><![CDATA[$_POST['destination_db']]]></code>
|
||||
<code><![CDATA[$_POST['destination_foreign_column']]]></code>
|
||||
<code><![CDATA[$_POST['destination_foreign_db']]]></code>
|
||||
<code><![CDATA[$_POST['destination_foreign_table']]]></code>
|
||||
<code><![CDATA[$_POST['destination_table']]]></code>
|
||||
<code><![CDATA[$multiEditColumnsName]]></code>
|
||||
<code><![CDATA[$multiEditColumnsName]]></code>
|
||||
<code><![CDATA[usort($tables, strnatcasecmp(...))]]></code>
|
||||
</InvalidArgument>
|
||||
<PossiblyInvalidArgument>
|
||||
<code><![CDATA[$_POST['display_field']]]></code>
|
||||
<code><![CDATA[$_POST['foreignDb']]]></code>
|
||||
<code><![CDATA[$_POST['foreignDb']]]></code>
|
||||
@ -2998,8 +3000,6 @@
|
||||
<code><![CDATA[$_POST['foreignDb']]]></code>
|
||||
<code><![CDATA[$foreignTable]]></code>
|
||||
<code><![CDATA[$foreignTable]]></code>
|
||||
<code><![CDATA[$multiEditColumnsName]]></code>
|
||||
<code><![CDATA[$multiEditColumnsName]]></code>
|
||||
</PossiblyInvalidArgument>
|
||||
<PossiblyInvalidCast>
|
||||
<code><![CDATA[$_POST['display_field']]]></code>
|
||||
@ -9925,27 +9925,11 @@
|
||||
</InvalidReturnType>
|
||||
<MixedArgument>
|
||||
<code><![CDATA[$_POST['constraint_name'][$masterFieldMd5]]]></code>
|
||||
<code><![CDATA[$column]]></code>
|
||||
<code><![CDATA[$column['Extra']]]></code>
|
||||
<code><![CDATA[$column['Extra']]]></code>
|
||||
<code><![CDATA[$fields[$column]['expr']]]></code>
|
||||
<code><![CDATA[$foreignDb]]></code>
|
||||
<code><![CDATA[$foreignDb]]></code>
|
||||
<code><![CDATA[$foreignDb]]></code>
|
||||
<code><![CDATA[$foreignField]]></code>
|
||||
<code><![CDATA[$foreignField]]></code>
|
||||
<code><![CDATA[$foreignField]]></code>
|
||||
<code><![CDATA[$foreignTable]]></code>
|
||||
<code><![CDATA[$foreignTable]]></code>
|
||||
<code><![CDATA[$foreignTable]]></code>
|
||||
<code><![CDATA[$index]]></code>
|
||||
<code><![CDATA[$index[0]]]></code>
|
||||
<code><![CDATA[$masterField]]></code>
|
||||
<code><![CDATA[$masterField]]></code>
|
||||
<code><![CDATA[$masterField]]></code>
|
||||
<code><![CDATA[$masterField]]></code>
|
||||
<code><![CDATA[$oneField]]></code>
|
||||
<code><![CDATA[$oneField]]></code>
|
||||
<code><![CDATA[$options['expr']]]></code>
|
||||
<code><![CDATA[$row['Type']]]></code>
|
||||
<code><![CDATA[$this->uiprefs[$property->value]]]></code>
|
||||
@ -9953,9 +9937,8 @@
|
||||
<code><![CDATA[$value]]></code>
|
||||
</MixedArgument>
|
||||
<MixedArgumentTypeCoercion>
|
||||
<code><![CDATA[$field]]></code>
|
||||
<code><![CDATA[$foreignField]]></code>
|
||||
<code><![CDATA[$masterField]]></code>
|
||||
<code><![CDATA[$indexed]]></code>
|
||||
<code><![CDATA[$indexed]]></code>
|
||||
</MixedArgumentTypeCoercion>
|
||||
<MixedArrayAccess>
|
||||
<code><![CDATA[$_SESSION['tmpval']['table_uiprefs'][$serverId][$this->dbName][$this->name]]]></code>
|
||||
@ -9965,10 +9948,8 @@
|
||||
<code><![CDATA[$existrel[$masterField]['foreign_db']]]></code>
|
||||
<code><![CDATA[$existrel[$masterField]['foreign_field']]]></code>
|
||||
<code><![CDATA[$existrel[$masterField]['foreign_table']]]></code>
|
||||
<code><![CDATA[$foreignField[$key]]]></code>
|
||||
<code><![CDATA[$index[0]]]></code>
|
||||
<code><![CDATA[$index[0]]]></code>
|
||||
<code><![CDATA[$masterField[$key]]]></code>
|
||||
<code><![CDATA[$row['Field']]]></code>
|
||||
<code><![CDATA[$row['Field']]]></code>
|
||||
<code><![CDATA[$row['Type']]]></code>
|
||||
@ -9983,49 +9964,24 @@
|
||||
<MixedArrayOffset>
|
||||
<code><![CDATA[$columns[$row['Field']]]]></code>
|
||||
<code><![CDATA[$columns[$row['Field']]]]></code>
|
||||
<code><![CDATA[$existrel[$masterField]]]></code>
|
||||
<code><![CDATA[$existrel[$masterField]]]></code>
|
||||
<code><![CDATA[$foreignField[$key]]]></code>
|
||||
<code><![CDATA[$foreignField[$key]]]></code>
|
||||
<code><![CDATA[$foreignField[$key]]]></code>
|
||||
<code><![CDATA[$foreignField[$key]]]></code>
|
||||
<code><![CDATA[$masterField[$key]]]></code>
|
||||
<code><![CDATA[$optionsArray[$_POST['on_delete'][$masterFieldMd5]]]]></code>
|
||||
<code><![CDATA[$optionsArray[$_POST['on_update'][$masterFieldMd5]]]]></code>
|
||||
</MixedArrayOffset>
|
||||
<MixedAssignment>
|
||||
<code><![CDATA[$column]]></code>
|
||||
<code><![CDATA[$column]]></code>
|
||||
<code><![CDATA[$columns[$row['Field']]]]></code>
|
||||
<code><![CDATA[$foreignDb]]></code>
|
||||
<code><![CDATA[$foreignDb]]></code>
|
||||
<code><![CDATA[$foreignField]]></code>
|
||||
<code><![CDATA[$foreignField]]></code>
|
||||
<code><![CDATA[$foreignTable]]></code>
|
||||
<code><![CDATA[$foreignTable]]></code>
|
||||
<code><![CDATA[$index]]></code>
|
||||
<code><![CDATA[$key]]></code>
|
||||
<code><![CDATA[$masterField]]></code>
|
||||
<code><![CDATA[$masterField]]></code>
|
||||
<code><![CDATA[$oneField]]></code>
|
||||
<code><![CDATA[$oneField]]></code>
|
||||
<code><![CDATA[$oneField]]></code>
|
||||
<code><![CDATA[$ret[]]]></code>
|
||||
<code><![CDATA[$row]]></code>
|
||||
<code><![CDATA[$value]]></code>
|
||||
</MixedAssignment>
|
||||
<MixedInferredReturnType>
|
||||
<code><![CDATA[mixed[]]]></code>
|
||||
<code><![CDATA[string]]></code>
|
||||
<code><![CDATA[string]]></code>
|
||||
</MixedInferredReturnType>
|
||||
<MixedOperand>
|
||||
<code><![CDATA[$backquoted ? Util::backquote($column) : $column]]></code>
|
||||
<code><![CDATA[$index[0]]]></code>
|
||||
</MixedOperand>
|
||||
<MixedReturnStatement>
|
||||
<code><![CDATA[end($this->errors)]]></code>
|
||||
<code><![CDATA[end($this->messages)]]></code>
|
||||
<code><![CDATA[json_decode($value, true)]]></code>
|
||||
</MixedReturnStatement>
|
||||
<MixedReturnTypeCoercion>
|
||||
@ -10059,6 +10015,11 @@
|
||||
<RiskyTruthyFalsyComparison>
|
||||
<code><![CDATA[empty($existrelForeign[$masterFieldMd5]->onDelete)]]></code>
|
||||
<code><![CDATA[empty($existrelForeign[$masterFieldMd5]->onUpdate)]]></code>
|
||||
<code><![CDATA[empty($foreignField)]]></code>
|
||||
<code><![CDATA[empty($foreignField[$key])]]></code>
|
||||
<code><![CDATA[empty($foreignField[$key])]]></code>
|
||||
<code><![CDATA[empty($foreignField[$key])]]></code>
|
||||
<code><![CDATA[empty($foreignTable)]]></code>
|
||||
</RiskyTruthyFalsyComparison>
|
||||
<UnsupportedPropertyReferenceUsage>
|
||||
<code><![CDATA[$this->uiprefs =& $_SESSION['tmpval']['table_uiprefs'][$serverId][$this->dbName][$this->name]]]></code>
|
||||
|
||||
@ -69,10 +69,10 @@ class Table implements Stringable
|
||||
/** @var mixed[] UI preferences */
|
||||
public array $uiprefs = [];
|
||||
|
||||
/** @var mixed[] errors occurred */
|
||||
/** @var string[] errors occurred */
|
||||
public array $errors = [];
|
||||
|
||||
/** @var mixed[] messages */
|
||||
/** @var string[] messages */
|
||||
public array $messages = [];
|
||||
|
||||
private Relation $relation;
|
||||
@ -939,9 +939,9 @@ class Table implements Stringable
|
||||
*
|
||||
* e.g. index(col1, col2) would return col1, col2
|
||||
*
|
||||
* @param mixed[] $indexed column data
|
||||
* @param bool $backquoted whether to quote name with backticks ``
|
||||
* @param bool $fullName whether to include full name of the table as a prefix
|
||||
* @param string[] $indexed column data
|
||||
* @param bool $backquoted whether to quote name with backticks ``
|
||||
* @param bool $fullName whether to include full name of the table as a prefix
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
@ -1355,11 +1355,11 @@ class Table implements Stringable
|
||||
/**
|
||||
* Function to get update query for updating internal relations
|
||||
*
|
||||
* @param mixed[] $multiEditColumnsName multi edit column names
|
||||
* @param mixed[] $destinationDb destination tables
|
||||
* @param mixed[] $destinationTable destination tables
|
||||
* @param mixed[] $destinationColumn destination columns
|
||||
* @param mixed[]|null $existrel db, table, column
|
||||
* @param string[] $multiEditColumnsName multi edit column names
|
||||
* @param string[] $destinationDb destination tables
|
||||
* @param (string|null)[] $destinationTable destination tables
|
||||
* @param (string|null)[] $destinationColumn destination columns
|
||||
* @param mixed[]|null $existrel db, table, column
|
||||
*/
|
||||
public function updateInternalRelations(
|
||||
array $multiEditColumnsName,
|
||||
@ -1437,10 +1437,10 @@ class Table implements Stringable
|
||||
/**
|
||||
* Function to handle foreign key updates
|
||||
*
|
||||
* @param mixed[] $destinationForeignDb destination foreign database
|
||||
* @param mixed[] $multiEditColumnsName multi edit column names
|
||||
* @param mixed[] $destinationForeignTable destination foreign table
|
||||
* @param mixed[] $destinationForeignColumn destination foreign column
|
||||
* @param string[] $destinationForeignDb destination foreign database
|
||||
* @param string[][] $multiEditColumnsName multi edit column names
|
||||
* @param string[] $destinationForeignTable destination foreign table
|
||||
* @param string[][] $destinationForeignColumn destination foreign column
|
||||
* @param string[] $optionsArray options array
|
||||
* @param string $table current table
|
||||
* @param ForeignKey[] $existrelForeign db, table, column
|
||||
@ -1616,10 +1616,10 @@ class Table implements Stringable
|
||||
* Returns the SQL query for foreign key constraint creation
|
||||
*
|
||||
* @param string $table table name
|
||||
* @param mixed[] $field field names
|
||||
* @param string[] $field field names
|
||||
* @param string $foreignDb foreign database name
|
||||
* @param string $foreignTable foreign table name
|
||||
* @param mixed[] $foreignField foreign field names
|
||||
* @param string[] $foreignField foreign field names
|
||||
* @param string|null $name name of the constraint
|
||||
* @param string|null $onDelete on delete action
|
||||
* @param string|null $onUpdate on update action
|
||||
|
||||
Loading…
Reference in New Issue
Block a user