From b948f77af4f3039cd605a1eddf2ba88ef9eb6b3f Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Fri, 28 Mar 2025 10:25:11 +0100 Subject: [PATCH] Doc-comments: Fix type errors --- adminer/drivers/mssql.inc.php | 24 ++++++++++++------------ adminer/drivers/mysql.inc.php | 15 ++++++++------- adminer/drivers/oracle.inc.php | 18 +++++++++--------- adminer/drivers/pgsql.inc.php | 18 ++++++++++-------- adminer/drivers/sqlite.inc.php | 20 ++++++++++---------- adminer/include/editing.inc.php | 2 +- adminer/include/functions.inc.php | 14 +++++++++----- adminer/include/pdo.inc.php | 2 +- adminer/include/tmpfile.inc.php | 2 +- phpstan.neon | 5 +++-- plugins/drivers/clickhouse.php | 12 ++++++------ plugins/drivers/elastic.php | 10 +++++----- plugins/drivers/firebird.php | 10 +++++----- plugins/drivers/imap.php | 10 +++++----- plugins/drivers/mongo.php | 12 ++++++------ plugins/drivers/simpledb.php | 12 ++++++------ 16 files changed, 97 insertions(+), 89 deletions(-) diff --git a/adminer/drivers/mssql.inc.php b/adminer/drivers/mssql.inc.php index 7b16d85b..d50004ae 100644 --- a/adminer/drivers/mssql.inc.php +++ b/adminer/drivers/mssql.inc.php @@ -13,7 +13,7 @@ if (isset($_GET["mssql"])) { define('Adminer\DRIVER', "mssql"); if (extension_loaded("sqlsrv") && $_GET["ext"] != "pdo") { class Db extends SqlDb { - public $extension = "sqlsrv"; + public string $extension = "sqlsrv"; private $link, $result; private function get_error() { @@ -124,7 +124,7 @@ if (isset($_GET["mssql"])) { return $this->convert(sqlsrv_fetch_array($this->result, SQLSRV_FETCH_NUMERIC)); } - function fetch_field(): object { + function fetch_field(): \stdClass { if (!$this->fields) { $this->fields = sqlsrv_field_metadata($this->result); } @@ -180,7 +180,7 @@ if (isset($_GET["mssql"])) { if (extension_loaded("pdo_sqlsrv")) { class Db extends MssqlDb { - public $extension = "PDO_SQLSRV"; + public string $extension = "PDO_SQLSRV"; function connect(string $server, string $username, string $password): bool { $this->dsn("sqlsrv:Server=" . str_replace(":", ",", $server), $username, $password); @@ -190,7 +190,7 @@ if (isset($_GET["mssql"])) { } elseif (extension_loaded("pdo_dblib")) { class Db extends MssqlDb { - public $extension = "PDO_DBLIB"; + public string $extension = "PDO_DBLIB"; function connect(string $server, string $username, string $password): bool { $this->dsn("dblib:charset=utf8;host=" . str_replace(":", ";unix_socket=", preg_replace('~:(\d)~', ';port=\1', $server)), $username, $password); @@ -202,10 +202,10 @@ if (isset($_GET["mssql"])) { class Driver extends SqlDriver { - static $possibleDrivers = array("SQLSRV", "PDO_SQLSRV", "PDO_DBLIB"); - static $jush = "mssql"; + static array $possibleDrivers = array("SQLSRV", "PDO_SQLSRV", "PDO_DBLIB"); + static string $jush = "mssql"; - public $editFunctions = array( + public array $editFunctions = array( array( "date|time" => "getdate", ), array( @@ -214,11 +214,11 @@ if (isset($_GET["mssql"])) { ) ); - public $operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL"); - public $functions = array("len", "lower", "round", "upper"); - public $grouping = array("avg", "count", "count distinct", "max", "min", "sum"); - public $onActions = "NO ACTION|CASCADE|SET NULL|SET DEFAULT"; - public $generated = array("PERSISTED", "VIRTUAL"); + public array $operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL"); + public array $functions = array("len", "lower", "round", "upper"); + public array $grouping = array("avg", "count", "count distinct", "max", "min", "sum"); + public array $generated = array("PERSISTED", "VIRTUAL"); + public string $onActions = "NO ACTION|CASCADE|SET NULL|SET DEFAULT"; function __construct(Db $connection) { parent::__construct($connection); diff --git a/adminer/drivers/mysql.inc.php b/adminer/drivers/mysql.inc.php index be50d52a..d681dbfc 100644 --- a/adminer/drivers/mysql.inc.php +++ b/adminer/drivers/mysql.inc.php @@ -8,7 +8,7 @@ if (!defined('Adminer\DRIVER')) { // MySQLi supports everything, MySQL doesn't support multiple result sets, PDO_MySQL doesn't support orgtable if (extension_loaded("mysqli") && $_GET["ext"] != "pdo") { class Db extends \MySQLi { - public $extension = "MySQLi", $flavor = ''; + public string $extension = "MySQLi", $flavor = ''; function __construct() { parent::init(); @@ -61,7 +61,7 @@ if (!defined('Adminer\DRIVER')) { } elseif (extension_loaded("mysql") && !((ini_bool("sql.safe_mode") || ini_bool("mysql.allow_local_infile")) && extension_loaded("pdo_mysql"))) { class Db extends SqlDb { - private resource $link; + /** @var resource */ private $link; function connect(string $server, string $username, string $password): bool { if (ini_bool("mysql.allow_local_infile")) { @@ -122,10 +122,11 @@ if (!defined('Adminer\DRIVER')) { class Result { public int $num_rows; // number of rows in the result - private resource $result; + /** @var resource */ private $result; private int $offset = 0; - function __construct(resource $result) { + /** @param resource $result */ + function __construct($result) { $this->result = $result; $this->num_rows = mysql_num_rows($result); } @@ -145,9 +146,9 @@ if (!defined('Adminer\DRIVER')) { } /** Fetch next field - * @return object properties: name, type (0 number, 15 varchar, 254 char), charsetnr (63 binary); optionally: table, orgtable, orgname + * @return \stdClass properties: name, type (0 number, 15 varchar, 254 char), charsetnr (63 binary); optionally: table, orgtable, orgname */ - function fetch_field(): object { + function fetch_field(): \stdClass { $return = mysql_fetch_field($this->result, $this->offset++); // offset required under certain conditions $return->orgtable = $return->table; $return->charsetnr = ($return->blob ? 63 : 0); @@ -162,7 +163,7 @@ if (!defined('Adminer\DRIVER')) { } elseif (extension_loaded("pdo_mysql")) { class Db extends PdoDb { - public $extension = "PDO_MySQL"; + public string $extension = "PDO_MySQL"; function connect(string $server, string $username, string $password): bool { global $adminer; diff --git a/adminer/drivers/oracle.inc.php b/adminer/drivers/oracle.inc.php index 55c9447f..bc8ca549 100644 --- a/adminer/drivers/oracle.inc.php +++ b/adminer/drivers/oracle.inc.php @@ -7,7 +7,7 @@ if (isset($_GET["oracle"])) { define('Adminer\DRIVER', "oracle"); if (extension_loaded("oci8") && $_GET["ext"] != "pdo") { class Db extends SqlDb { - public $extension = "oci8"; + public string $extension = "oci8"; public $_current_db; private $link; @@ -87,7 +87,7 @@ if (isset($_GET["oracle"])) { return $this->convert(oci_fetch_row($this->result)); } - function fetch_field(): object { + function fetch_field(): \stdClass { $column = $this->offset++; $return = new \stdClass; $return->name = oci_field_name($this->result, $column); @@ -103,7 +103,7 @@ if (isset($_GET["oracle"])) { } elseif (extension_loaded("pdo_oci")) { class Db extends PdoDb { - public $extension = "PDO_OCI"; + public string $extension = "PDO_OCI"; public $_current_db; function connect(string $server, string $username, string $password): bool { @@ -122,10 +122,10 @@ if (isset($_GET["oracle"])) { class Driver extends SqlDriver { - static $possibleDrivers = array("OCI8", "PDO_OCI"); - static $jush = "oracle"; + static array $possibleDrivers = array("OCI8", "PDO_OCI"); + static string $jush = "oracle"; - public $editFunctions = array( + public array $editFunctions = array( array( //! no parentheses "date" => "current_date", "timestamp" => "current_timestamp", @@ -136,9 +136,9 @@ if (isset($_GET["oracle"])) { ) ); - public $operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL", "SQL"); - public $functions = array("length", "lower", "round", "upper"); - public $grouping = array("avg", "count", "count distinct", "max", "min", "sum"); + public array $operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL", "SQL"); + public array $functions = array("length", "lower", "round", "upper"); + public array $grouping = array("avg", "count", "count distinct", "max", "min", "sum"); function __construct(Db $connection) { parent::__construct($connection); diff --git a/adminer/drivers/pgsql.inc.php b/adminer/drivers/pgsql.inc.php index 069e329f..97c5173c 100644 --- a/adminer/drivers/pgsql.inc.php +++ b/adminer/drivers/pgsql.inc.php @@ -7,7 +7,8 @@ if (isset($_GET["pgsql"])) { define('Adminer\DRIVER', "pgsql"); if (extension_loaded("pgsql") && $_GET["ext"] != "pdo") { class Db extends SqlDb { - public $extension = "PgSQL", $timeout; + public string $extension = "PgSQL"; + public int $timeout; private $link, $string, $database = true; function _error($errno, $error) { @@ -108,7 +109,7 @@ if (isset($_GET["pgsql"])) { return pg_fetch_row($this->result); } - function fetch_field(): object { + function fetch_field(): \stdClass { $column = $this->offset++; $return = new \stdClass; $return->orgtable = pg_field_table($this->result, $column); @@ -125,7 +126,8 @@ if (isset($_GET["pgsql"])) { } elseif (extension_loaded("pdo_pgsql")) { class Db extends PdoDb { - public $extension = "PDO_PgSQL", $timeout; + public string $extension = "PDO_PgSQL"; + public int $timeout; function connect(string $server, string $username, string $password): bool { global $adminer; @@ -167,12 +169,12 @@ if (isset($_GET["pgsql"])) { class Driver extends SqlDriver { - static $possibleDrivers = array("PgSQL", "PDO_PgSQL"); - static $jush = "pgsql"; + static array $possibleDrivers = array("PgSQL", "PDO_PgSQL"); + static string $jush = "pgsql"; - public $operators = array("=", "<", ">", "<=", ">=", "!=", "~", "!~", "LIKE", "LIKE %%", "ILIKE", "ILIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL"); // no "SQL" to avoid CSRF - public $functions = array("char_length", "lower", "round", "to_hex", "to_timestamp", "upper"); - public $grouping = array("avg", "count", "count distinct", "max", "min", "sum"); + public array $operators = array("=", "<", ">", "<=", ">=", "!=", "~", "!~", "LIKE", "LIKE %%", "ILIKE", "ILIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL"); // no "SQL" to avoid CSRF + public array $functions = array("char_length", "lower", "round", "to_hex", "to_timestamp", "upper"); + public array $grouping = array("avg", "count", "count distinct", "max", "min", "sum"); function __construct(Db $connection) { parent::__construct($connection); diff --git a/adminer/drivers/sqlite.inc.php b/adminer/drivers/sqlite.inc.php index f7a0f3c0..b6b7e623 100644 --- a/adminer/drivers/sqlite.inc.php +++ b/adminer/drivers/sqlite.inc.php @@ -8,7 +8,7 @@ if (isset($_GET["sqlite"])) { if (class_exists("SQLite3") && $_GET["ext"] != "pdo") { abstract class SqliteDb extends SqlDb { - public $extension = "SQLite3"; + public string $extension = "SQLite3"; private $link; function connect(string $filename, string $username = '', string $password = ''): bool { @@ -56,7 +56,7 @@ if (isset($_GET["sqlite"])) { return $this->result->fetchArray(SQLITE3_NUM); } - function fetch_field(): object { + function fetch_field(): \stdClass { $column = $this->offset++; $type = $this->result->columnType($column); return (object) array( @@ -73,7 +73,7 @@ if (isset($_GET["sqlite"])) { } elseif (extension_loaded("pdo_sqlite")) { abstract class SqliteDb extends PdoDb { - public $extension = "PDO_SQLite"; + public string $extension = "PDO_SQLite"; function connect(string $filename, string $username = '', string $password = ''): bool { $this->dsn(DRIVER . ":$filename", "", ""); @@ -106,12 +106,12 @@ if (isset($_GET["sqlite"])) { class Driver extends SqlDriver { - static $possibleDrivers = array("SQLite3", "PDO_SQLite"); - static $jush = "sqlite"; + static array $possibleDrivers = array("SQLite3", "PDO_SQLite"); + static string $jush = "sqlite"; - protected $types = array(array("integer" => 0, "real" => 0, "numeric" => 0, "text" => 0, "blob" => 0)); + protected array $types = array(array("integer" => 0, "real" => 0, "numeric" => 0, "text" => 0, "blob" => 0)); - public $editFunctions = array( + public array $editFunctions = array( array( // "text" => "date('now')/time('now')/datetime('now')", ), array( @@ -121,9 +121,9 @@ if (isset($_GET["sqlite"])) { ) ); - public $operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL", "SQL"); // REGEXP can be user defined function - public $functions = array("hex", "length", "lower", "round", "unixepoch", "upper"); - public $grouping = array("avg", "count", "count distinct", "group_concat", "max", "min", "sum"); + public array $operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL", "SQL"); // REGEXP can be user defined function + public array $functions = array("hex", "length", "lower", "round", "unixepoch", "upper"); + public array $grouping = array("avg", "count", "count distinct", "group_concat", "max", "min", "sum"); function __construct(Db $connection) { parent::__construct($connection); diff --git a/adminer/include/editing.inc.php b/adminer/include/editing.inc.php index f30b1f3c..e59c589d 100644 --- a/adminer/include/editing.inc.php +++ b/adminer/include/editing.inc.php @@ -361,7 +361,7 @@ function edit_fields(array $fields, array $collations, $type = "TABLE", array $f /** Move fields up and down or add field * @param Field[] $fields */ -function process_fields(&array $fields): bool { +function process_fields(array &$fields): bool { $offset = 0; if ($_POST["up"]) { $last = 0; diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php index 5266fceb..46dd2be7 100644 --- a/adminer/include/functions.inc.php +++ b/adminer/include/functions.inc.php @@ -476,7 +476,7 @@ function queries(string $query) { * @param list $tables * @param callable(string):string $escape */ -function apply_queries(string $query, array $tables, callable $escape = 'Adminer\table'): bool { +function apply_queries(string $query, array $tables, $escape = 'Adminer\table'): bool { foreach ($tables as $table) { if (!queries("$query " . $escape($table))) { return false; @@ -712,16 +712,20 @@ function file_open_lock(string $filename) { return $fp; } -/** Write and unlock a file */ -function file_write_unlock(resource $fp, string $data): void { +/** Write and unlock a file +* @param resource $fp +*/ +function file_write_unlock($fp, string $data): void { rewind($fp); fwrite($fp, $data); ftruncate($fp, strlen($data)); file_unlock($fp); } -/** Unlock and close a file */ -function file_unlock(resource $fp): void { +/** Unlock and close a file +* @param resource $fp +*/ +function file_unlock($fp): void { flock($fp, LOCK_UN); fclose($fp); } diff --git a/adminer/include/pdo.inc.php b/adminer/include/pdo.inc.php index 3169529b..cf9f2d19 100644 --- a/adminer/include/pdo.inc.php +++ b/adminer/include/pdo.inc.php @@ -76,7 +76,7 @@ if (extension_loaded('pdo')) { return $this->fetch(\PDO::FETCH_NUM); } - function fetch_field(): object { + function fetch_field(): \stdClass { $row = (object) $this->getColumnMeta($this->_offset++); $type = $row->pdo_type; $row->type = ($type == \PDO::PARAM_INT ? 0 : 15); diff --git a/adminer/include/tmpfile.inc.php b/adminer/include/tmpfile.inc.php index 02a0101d..88b7712c 100644 --- a/adminer/include/tmpfile.inc.php +++ b/adminer/include/tmpfile.inc.php @@ -2,7 +2,7 @@ namespace Adminer; class TmpFile { - private resource $handler; + /** @var resource */ private $handler; /** @visibility protected(set) */ public int $size; function __construct() { diff --git a/phpstan.neon b/phpstan.neon index 99bc9d14..fee0205b 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -24,7 +24,7 @@ parameters: paths: - adminer/include/pdo.inc.php - adminer/drivers/* - + - message: "~ to an undefined ~" # PostgreSQL has this in its version of Db path: adminer/drivers/pgsql.inc.php @@ -52,6 +52,7 @@ parameters: scanFiles: - compile.php # compile_file() excludePaths: + - adminer/adminer-plugins/ - adminer/lang/ - adminer/adminer-plugins.php - adminer/designs.php @@ -59,7 +60,7 @@ parameters: - adminer/sqlite.php phpVersion: - min: 70100 + min: 70400 max: 80499 typeAliases: diff --git a/plugins/drivers/clickhouse.php b/plugins/drivers/clickhouse.php index f434e1ad..b7ca723a 100644 --- a/plugins/drivers/clickhouse.php +++ b/plugins/drivers/clickhouse.php @@ -8,7 +8,7 @@ if (isset($_GET["clickhouse"])) { if (ini_bool('allow_url_fopen')) { class Db extends SqlDb { - public $extension = "JSON"; + public string $extension = "JSON"; public $_db = 'default'; private $url; @@ -103,7 +103,7 @@ if (isset($_GET["clickhouse"])) { return $row; } - function fetch_field(): object { + function fetch_field(): \stdClass { $column = $this->offset++; $return = new \stdClass; if ($column < count($this->columns)) { @@ -117,11 +117,11 @@ if (isset($_GET["clickhouse"])) { } class Driver extends SqlDriver { - static $possibleDrivers = array("allow_url_fopen"); - static $jush = "clickhouse"; + static array $possibleDrivers = array("allow_url_fopen"); + static string $jush = "clickhouse"; - public $operators = array("=", "<", ">", "<=", ">=", "!=", "~", "!~", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL", "SQL"); - public $grouping = array("avg", "count", "count distinct", "max", "min", "sum"); + public array $operators = array("=", "<", ">", "<=", ">=", "!=", "~", "!~", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL", "SQL"); + public array $grouping = array("avg", "count", "count distinct", "max", "min", "sum"); function __construct(Db $connection) { parent::__construct($connection); diff --git a/plugins/drivers/elastic.php b/plugins/drivers/elastic.php index 5e5e1343..7f99eaf7 100644 --- a/plugins/drivers/elastic.php +++ b/plugins/drivers/elastic.php @@ -9,7 +9,7 @@ if (isset($_GET["elastic"])) { if (ini_bool('allow_url_fopen')) { class Db extends SqlDb { - public $extension = "JSON"; + public string $extension = "JSON"; private $url; /** @@ -108,11 +108,11 @@ if (isset($_GET["elastic"])) { } class Driver extends SqlDriver { - static $possibleDrivers = array("json + allow_url_fopen"); - static $jush = "elastic"; + static array $possibleDrivers = array("json + allow_url_fopen"); + static string $jush = "elastic"; - public $editFunctions = array(array("json")); - public $operators = array("=", "must", "should", "must_not"); + public array $editFunctions = array(array("json")); + public array $operators = array("=", "must", "should", "must_not"); function __construct(Db $connection) { parent::__construct($connection); diff --git a/plugins/drivers/firebird.php b/plugins/drivers/firebird.php index 6030f05a..75522b87 100644 --- a/plugins/drivers/firebird.php +++ b/plugins/drivers/firebird.php @@ -12,7 +12,7 @@ if (isset($_GET["firebird"])) { if (extension_loaded("interbase")) { class Db extends SqlDb { - public $extension = "Firebird", $_link; + public string $extension = "Firebird", $_link; function connect(string $server, string $username, string $password): bool { $this->_link = ibase_connect($server, $username, $password); @@ -68,7 +68,7 @@ if (isset($_GET["firebird"])) { return ibase_fetch_row($this->result); } - function fetch_field(): object { + function fetch_field(): \stdClass { $field = ibase_field_info($this->result, $this->offset++); return (object) array( 'name' => $field['name'], @@ -87,10 +87,10 @@ if (isset($_GET["firebird"])) { class Driver extends SqlDriver { - static $possibleDrivers = array("interbase"); - static $jush = "firebird"; + static array $possibleDrivers = array("interbase"); + static string $jush = "firebird"; - public $operators = array("="); + public array $operators = array("="); } diff --git a/plugins/drivers/imap.php b/plugins/drivers/imap.php index bde674a5..85357eae 100644 --- a/plugins/drivers/imap.php +++ b/plugins/drivers/imap.php @@ -19,7 +19,7 @@ if (isset($_GET["imap"])) { if (extension_loaded("imap")) { class Db extends SqlDb { - public $extension = "IMAP"; + public string $extension = "IMAP"; public $server_info = "?"; // imap_mailboxmsginfo() or imap_check() don't return anything useful private $mailbox; private $imap; @@ -134,7 +134,7 @@ if (isset($_GET["imap"])) { return ($row ? array_values($row) : false); } - function fetch_field(): object { + function fetch_field(): \stdClass { $field = current($this->fields); next($this->fields); return ($field != '' ? (object) array('name' => $field, 'type' => 15, 'charsetnr' => 0) : false); @@ -143,9 +143,9 @@ if (isset($_GET["imap"])) { } class Driver extends SqlDriver { - static $possibleDrivers = array("imap"); - static $jush = "imap"; - public $editFunctions = array(array("json")); + static array $possibleDrivers = array("imap"); + static string $jush = "imap"; + public array $editFunctions = array(array("json")); } function logged_user() { diff --git a/plugins/drivers/mongo.php b/plugins/drivers/mongo.php index 8b0d74b5..96bda627 100644 --- a/plugins/drivers/mongo.php +++ b/plugins/drivers/mongo.php @@ -8,7 +8,7 @@ if (isset($_GET["mongo"])) { if (class_exists('MongoDB\Driver\Manager')) { class Db extends SqlDb { - public $extension = "MongoDB", $server_info = MONGODB_VERSION, $last_id; + public string $extension = "MongoDB", $server_info = MONGODB_VERSION, $last_id; public \MongoDB\Driver\Manager $_link; public $_db, $_db_name; @@ -118,7 +118,7 @@ if (isset($_GET["mongo"])) { return array_values($return); } - function fetch_field(): object { + function fetch_field(): \stdClass { $keys = array_keys($this->rows[0]); $name = $keys[$this->offset++]; return (object) array( @@ -293,12 +293,12 @@ if (isset($_GET["mongo"])) { class Driver extends SqlDriver { - static $possibleDrivers = array("mongodb"); - static $jush = "mongo"; + static array $possibleDrivers = array("mongodb"); + static string $jush = "mongo"; - public $editFunctions = array(array("json")); + public array $editFunctions = array(array("json")); - public $operators = array( + public array $operators = array( "=", "!=", ">", diff --git a/plugins/drivers/simpledb.php b/plugins/drivers/simpledb.php index 89445219..82fa2452 100644 --- a/plugins/drivers/simpledb.php +++ b/plugins/drivers/simpledb.php @@ -8,7 +8,7 @@ if (isset($_GET["simpledb"])) { if (class_exists('SimpleXMLElement') && ini_bool('allow_url_fopen')) { class Db extends SqlDb { - public $extension = "SimpleXML", $server_info = '2009-04-15', $timeout, $next; + public string $extension = "SimpleXML", $server_info = '2009-04-15', $timeout, $next; function select_db(string $database): bool { return ($database == "domain"); @@ -97,7 +97,7 @@ if (isset($_GET["simpledb"])) { return array_values($return); } - function fetch_field(): object { + function fetch_field(): \stdClass { $keys = array_keys($this->rows[0]); return (object) array('name' => $keys[$this->offset++], 'type' => 15, 'charsetnr' => 0); } @@ -107,11 +107,11 @@ if (isset($_GET["simpledb"])) { class Driver extends SqlDriver { - static $possibleDrivers = array("SimpleXML + allow_url_fopen"); - static $jush = "simpledb"; + static array $possibleDrivers = array("SimpleXML + allow_url_fopen"); + static string $jush = "simpledb"; - public $operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "IS NOT NULL"); - public $grouping = array("count"); + public array $operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "IS NOT NULL"); + public array $grouping = array("count"); public $primary = "itemName()";