mirror of
https://github.com/vrana/adminer.git
synced 2025-08-10 08:34:20 +02:00
Doc-comments: Use array shapes in @return
This uses https://phpstan.org/writing-php-code/phpdoc-types#array-shapes I'm not going to do this in @param, it would be better to use https://phpstan.org/writing-php-code/phpdoc-types#global-type-aliases
This commit is contained in:
@@ -549,7 +549,7 @@ if (!defined('Adminer\DRIVER')) {
|
||||
/** Get table status
|
||||
* @param string
|
||||
* @param bool return only "Name", "Engine" and "Comment" fields
|
||||
* @return array[] [$name => ["Name" => , "Engine" => , "Comment" => , "Oid" => , "Rows" => , "Collation" => , "Auto_increment" => , "Data_length" => , "Index_length" => , "Data_free" => ]] or only inner array with $name
|
||||
* @return array{Name:string, Engine:string, Comment:string, Oid:int, Rows:int, Collation:string, Auto_increment:int, Data_length:int, Index_length:int, Data_free:int}[] or only inner array with $name
|
||||
*/
|
||||
function table_status($name = "", $fast = false) {
|
||||
$return = array();
|
||||
@@ -596,7 +596,7 @@ if (!defined('Adminer\DRIVER')) {
|
||||
|
||||
/** Get information about fields
|
||||
* @param string
|
||||
* @return array[] [$name => ["field" =>, "full_type" =>, "type" =>, "length" =>, "unsigned" =>, "default" =>, "null" =>, "auto_increment" =>, "on_update" =>, "collation" =>, "privileges" =>, "comment" =>, "primary" =>, "generated" =>]]
|
||||
* @return array{field:string, full_type:string, type:string, length:int, unsigned:string, default:string, null:bool, auto_increment:bool, on_update:string, collation:string, privileges:int[], comment:string, primary:bool, generated:string}[]
|
||||
*/
|
||||
function fields($table) {
|
||||
global $connection;
|
||||
@@ -652,7 +652,7 @@ if (!defined('Adminer\DRIVER')) {
|
||||
/** Get table indexes
|
||||
* @param string
|
||||
* @param string Db to use
|
||||
* @return array[] [$key_name => ["type" => , "columns" => [], "lengths" => [], "descs" => []]]
|
||||
* @return array{type:string, columns:list<string>, lengths:list<int>, descs:list<bool>}[]
|
||||
*/
|
||||
function indexes($table, $connection2 = null) {
|
||||
$return = array();
|
||||
@@ -668,7 +668,7 @@ if (!defined('Adminer\DRIVER')) {
|
||||
|
||||
/** Get foreign keys in table
|
||||
* @param string
|
||||
* @return array[] [$name => ["db" => , "ns" => , "table" => , "source" => [], "target" => [], "on_delete" => , "on_update" => ]]
|
||||
* @return array{db:string, ns:string, table:string, source:list<string>, target:list<string>, on_delete:string, on_update:string}[]
|
||||
*/
|
||||
function foreign_keys($table) {
|
||||
global $driver;
|
||||
@@ -700,7 +700,7 @@ if (!defined('Adminer\DRIVER')) {
|
||||
|
||||
/** Get view SELECT
|
||||
* @param string
|
||||
* @return array ["select" => ]
|
||||
* @return array{select:string}
|
||||
*/
|
||||
function view($name) {
|
||||
return array("select" => preg_replace('~^(?:[^`]|`[^`]*`)*\s+AS\s+~isU', '', get_val("SHOW CREATE VIEW " . table($name), 1)));
|
||||
@@ -959,7 +959,7 @@ if (!defined('Adminer\DRIVER')) {
|
||||
|
||||
/** Get information about trigger
|
||||
* @param string trigger name
|
||||
* @return array ["Trigger" => , "Timing" => , "Event" => , "Of" => , "Type" => , "Statement" => ]
|
||||
* @return array{Trigger:string, Timing:string, Event:string, Of:string, Type:string, Statement:string}
|
||||
*/
|
||||
function trigger($name) {
|
||||
if ($name == "") {
|
||||
@@ -971,7 +971,7 @@ if (!defined('Adminer\DRIVER')) {
|
||||
|
||||
/** Get defined triggers
|
||||
* @param string
|
||||
* @return array[] [$name => [$timing, $event]]
|
||||
* @return array{string, string}[]4
|
||||
*/
|
||||
function triggers($table) {
|
||||
$return = array();
|
||||
@@ -982,7 +982,7 @@ if (!defined('Adminer\DRIVER')) {
|
||||
}
|
||||
|
||||
/** Get trigger options
|
||||
* @return list<string>[] ["Timing" => [], "Event" => [], "Type" => []]
|
||||
* @return array{Timing: list<string>, Event: list<string>, Type: list<string>}
|
||||
*/
|
||||
function trigger_options() {
|
||||
return array(
|
||||
@@ -995,7 +995,7 @@ if (!defined('Adminer\DRIVER')) {
|
||||
/** Get information about stored routine
|
||||
* @param string
|
||||
* @param string "FUNCTION" or "PROCEDURE"
|
||||
* @return array ["fields" => ["field" => , "type" => , "length" => , "unsigned" => , "inout" => , "collation" => ], "returns" => , "definition" => , "language" => ]
|
||||
* @return array{fields:list<array{field:string, type:string, length:string, unsigned:string, null:bool, full_type:string, inout:string, collation:string}>, comment:string, returns:array, definition:string, language:string}
|
||||
*/
|
||||
function routine($name, $type) {
|
||||
global $driver;
|
||||
|
@@ -15,14 +15,14 @@ class Adminer {
|
||||
}
|
||||
|
||||
/** Connection parameters
|
||||
* @return array [$server, $username, $password]
|
||||
* @return array{string, string, string}
|
||||
*/
|
||||
function credentials() {
|
||||
return array(SERVER, $_GET["username"], get_password());
|
||||
}
|
||||
|
||||
/** Get SSL connection options
|
||||
* @return array ["key" => filename, "cert" => filename, "ca" => filename] or null
|
||||
* @return string[] or null
|
||||
*/
|
||||
function connectSsl() {
|
||||
}
|
||||
@@ -220,7 +220,7 @@ class Adminer {
|
||||
/** Find backward keys for table
|
||||
* @param string
|
||||
* @param string
|
||||
* @return array[] $return[$target_table]["keys"][$key_name][$target_column] = $source_column; $return[$target_table]["name"] = $this->tableName($target_table);
|
||||
* @return array{keys:string[][], name:string}[]
|
||||
*/
|
||||
function backwardKeys($table, $tableName) {
|
||||
return array();
|
||||
|
@@ -218,7 +218,7 @@ function edit_type($key, $field, $collations, $foreign_keys = array(), $extra_ty
|
||||
|
||||
/** Get partition info
|
||||
* @param string
|
||||
* @return array
|
||||
* @return array{partition_by:string, partition:string, partitions:string, partition_names:list<string>, partition_values:list<string>}
|
||||
*/
|
||||
function get_partitions_info($table) {
|
||||
global $connection;
|
||||
|
@@ -701,7 +701,7 @@ function friendly_url($val) {
|
||||
/** Get status of a single table and fall back to name on error
|
||||
* @param string
|
||||
* @param bool
|
||||
* @return array[]
|
||||
* @return array[] same as table_status()
|
||||
*/
|
||||
function table_status1($table, $fast = false) {
|
||||
$return = table_status($table, $fast);
|
||||
@@ -724,7 +724,7 @@ function column_foreign_keys($table) {
|
||||
}
|
||||
|
||||
/** Compute fields() from $_POST edit data
|
||||
* @return array[]
|
||||
* @return array[] same as fields()
|
||||
*/
|
||||
function fields_from_edit() {
|
||||
global $driver;
|
||||
|
Reference in New Issue
Block a user