Switch class properties from PHP typing to PHPDoc for compatibility with PHP < 7.4.0
This commit is contained in:
parent
2c41bc7fbc
commit
d3a81f598b
|
@ -1,16 +1,33 @@
|
||||||
<?php
|
<?php
|
||||||
class Db_Migrations {
|
class Db_Migrations {
|
||||||
|
|
||||||
private string $base_filename = "schema.sql";
|
// TODO: class properties can be switched to PHP typing if/when the minimum PHP_VERSION is raised to 7.4.0+
|
||||||
private string $base_path;
|
/** @var string */
|
||||||
private string $migrations_path;
|
private $base_filename = "schema.sql";
|
||||||
private string $migrations_table;
|
|
||||||
private bool $base_is_latest;
|
|
||||||
private \PDO $pdo;
|
|
||||||
|
|
||||||
private int $cached_version;
|
/** @var string */
|
||||||
private int $cached_max_version;
|
private $base_path;
|
||||||
private int $max_version_override;
|
|
||||||
|
/** @var string */
|
||||||
|
private $migrations_path;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
private $migrations_table;
|
||||||
|
|
||||||
|
/** @var bool */
|
||||||
|
private $base_is_latest;
|
||||||
|
|
||||||
|
/** @var PDO */
|
||||||
|
private $pdo;
|
||||||
|
|
||||||
|
/** @var int */
|
||||||
|
private $cached_version;
|
||||||
|
|
||||||
|
/** @var int */
|
||||||
|
private $cached_max_version;
|
||||||
|
|
||||||
|
/** @var int */
|
||||||
|
private $max_version_override;
|
||||||
|
|
||||||
function __construct() {
|
function __construct() {
|
||||||
$this->pdo = Db::pdo();
|
$this->pdo = Db::pdo();
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
class Debug {
|
class Debug {
|
||||||
const LOG_DISABLED = -1;
|
const LOG_DISABLED = -1;
|
||||||
const LOG_NORMAL = 0;
|
const LOG_NORMAL = 0;
|
||||||
const LOG_VERBOSE = 1;
|
const LOG_VERBOSE = 1;
|
||||||
const LOG_EXTENDED = 2;
|
const LOG_EXTENDED = 2;
|
||||||
|
|
||||||
const ALL_LOG_LEVELS = [
|
const ALL_LOG_LEVELS = [
|
||||||
Debug::LOG_DISABLED,
|
Debug::LOG_DISABLED,
|
||||||
|
@ -12,26 +12,44 @@ class Debug {
|
||||||
Debug::LOG_EXTENDED,
|
Debug::LOG_EXTENDED,
|
||||||
];
|
];
|
||||||
|
|
||||||
/** @deprecated */
|
// TODO: class properties can be switched to PHP typing if/when the minimum PHP_VERSION is raised to 7.4.0+
|
||||||
public static int $LOG_DISABLED = self::LOG_DISABLED;
|
/**
|
||||||
|
* @deprecated
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public static $LOG_DISABLED = self::LOG_DISABLED;
|
||||||
|
|
||||||
/** @deprecated */
|
/**
|
||||||
public static int $LOG_NORMAL = self::LOG_NORMAL;
|
* @deprecated
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public static $LOG_NORMAL = self::LOG_NORMAL;
|
||||||
|
|
||||||
/** @deprecated */
|
/**
|
||||||
public static int $LOG_VERBOSE = self::LOG_VERBOSE;
|
* @deprecated
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public static $LOG_VERBOSE = self::LOG_VERBOSE;
|
||||||
|
|
||||||
/** @deprecated */
|
/**
|
||||||
public static int $LOG_EXTENDED = self::LOG_EXTENDED;
|
* @deprecated
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public static $LOG_EXTENDED = self::LOG_EXTENDED;
|
||||||
|
|
||||||
private static bool $enabled = false;
|
/** @var bool */
|
||||||
private static bool $quiet = false;
|
private static $enabled = false;
|
||||||
private static ?string $logfile = null;
|
|
||||||
|
/** @var bool */
|
||||||
|
private static $quiet = false;
|
||||||
|
|
||||||
|
/** @var string|null */
|
||||||
|
private static $logfile = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int Debug::LOG_*
|
* @var int Debug::LOG_*
|
||||||
*/
|
*/
|
||||||
private static int $loglevel = self::LOG_NORMAL;
|
private static $loglevel = self::LOG_NORMAL;
|
||||||
|
|
||||||
public static function set_logfile(string $logfile): void {
|
public static function set_logfile(string $logfile): void {
|
||||||
self::$logfile = $logfile;
|
self::$logfile = $logfile;
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
class DiskCache {
|
class DiskCache {
|
||||||
private string $dir;
|
// TODO: class properties can be switched to PHP typing if/when the minimum PHP_VERSION is raised to 7.4.0+
|
||||||
|
/** @var string */
|
||||||
|
private $dir;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* https://stackoverflow.com/a/53662733
|
* https://stackoverflow.com/a/53662733
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
class Mailer {
|
class Mailer {
|
||||||
private string $last_error = "";
|
// TODO: class properties can be switched to PHP typing if/when the minimum PHP_VERSION is raised to 7.4.0+
|
||||||
|
/** @var string */
|
||||||
|
private $last_error = "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array<string, mixed> $params
|
* @param array<string, mixed> $params
|
||||||
|
|
|
@ -1,38 +1,49 @@
|
||||||
<?php
|
<?php
|
||||||
class PluginHost {
|
class PluginHost {
|
||||||
private ?\Pdo $pdo = null;
|
// TODO: class properties can be switched to PHP typing if/when the minimum PHP_VERSION is raised to 7.4.0+
|
||||||
|
/** @var PDO|null */
|
||||||
|
private $pdo = null;
|
||||||
|
|
||||||
/* separate handle for plugin data so transaction while saving wouldn't clash with possible main
|
/**
|
||||||
tt-rss code transactions; only initialized when first needed */
|
* separate handle for plugin data so transaction while saving wouldn't clash with possible main
|
||||||
private ?\Pdo $pdo_data = null;
|
* tt-rss code transactions; only initialized when first needed
|
||||||
|
*
|
||||||
|
* @var PDO|null
|
||||||
|
*/
|
||||||
|
private $pdo_data = null;
|
||||||
|
|
||||||
/** @var array<string, array<int, array<int, Plugin>>> hook types -> priority levels -> Plugins */
|
/** @var array<string, array<int, array<int, Plugin>>> hook types -> priority levels -> Plugins */
|
||||||
private array $hooks = [];
|
private $hooks = [];
|
||||||
|
|
||||||
/** @var array<string, Plugin> */
|
/** @var array<string, Plugin> */
|
||||||
private array $plugins = [];
|
private $plugins = [];
|
||||||
|
|
||||||
/** @var array<string, array<string, Plugin>> handler type -> method type -> Plugin */
|
/** @var array<string, array<string, Plugin>> handler type -> method type -> Plugin */
|
||||||
private array $handlers = [];
|
private $handlers = [];
|
||||||
|
|
||||||
/** @var array<string, array{'description': string, 'suffix': string, 'arghelp': string, 'class': Plugin}> command type -> details array */
|
/** @var array<string, array{'description': string, 'suffix': string, 'arghelp': string, 'class': Plugin}> command type -> details array */
|
||||||
private array $commands = [];
|
private $commands = [];
|
||||||
|
|
||||||
/** @var array<string, array<string, mixed>> plugin name -> (potential profile array) -> key -> value */
|
/** @var array<string, array<string, mixed>> plugin name -> (potential profile array) -> key -> value */
|
||||||
private array $storage = [];
|
private $storage = [];
|
||||||
|
|
||||||
/** @var array<int, array<int, array{'id': int, 'title': string, 'sender': Plugin, 'icon': string}>> */
|
/** @var array<int, array<int, array{'id': int, 'title': string, 'sender': Plugin, 'icon': string}>> */
|
||||||
private array $feeds = [];
|
private $feeds = [];
|
||||||
|
|
||||||
/** @var array<string, Plugin> API method name, Plugin sender */
|
/** @var array<string, Plugin> API method name, Plugin sender */
|
||||||
private array $api_methods = [];
|
private $api_methods = [];
|
||||||
|
|
||||||
/** @var array<string, array<int, array{'action': string, 'description': string, 'sender': Plugin}>> */
|
/** @var array<string, array<int, array{'action': string, 'description': string, 'sender': Plugin}>> */
|
||||||
private array $plugin_actions = [];
|
private $plugin_actions = [];
|
||||||
|
|
||||||
private ?int $owner_uid = null;
|
/** @var int|null */
|
||||||
private bool $data_loaded = false;
|
private $owner_uid = null;
|
||||||
private static ?PluginHost $instance = null;
|
|
||||||
|
/** @var bool */
|
||||||
|
private $data_loaded = false;
|
||||||
|
|
||||||
|
/** @var PluginHost|null */
|
||||||
|
private static $instance = null;
|
||||||
|
|
||||||
const API_VERSION = 2;
|
const API_VERSION = 2;
|
||||||
const PUBLIC_METHOD_DELIMITER = "--";
|
const PUBLIC_METHOD_DELIMITER = "--";
|
||||||
|
|
|
@ -6,14 +6,30 @@ class UrlHelper {
|
||||||
"tel"
|
"tel"
|
||||||
];
|
];
|
||||||
|
|
||||||
static string $fetch_last_error;
|
// TODO: class properties can be switched to PHP typing if/when the minimum PHP_VERSION is raised to 7.4.0+
|
||||||
static int $fetch_last_error_code;
|
/** @var string */
|
||||||
static string $fetch_last_error_content;
|
static $fetch_last_error;
|
||||||
static string $fetch_last_content_type;
|
|
||||||
static string $fetch_last_modified;
|
/** @var int */
|
||||||
static string $fetch_effective_url;
|
static $fetch_last_error_code;
|
||||||
static string $fetch_effective_ip_addr;
|
|
||||||
static bool $fetch_curl_used;
|
/** @var string */
|
||||||
|
static $fetch_last_error_content;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
static $fetch_last_content_type;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
static $fetch_last_modified;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
static $fetch_effective_url;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
static $fetch_effective_ip_addr;
|
||||||
|
|
||||||
|
/** @var bool */
|
||||||
|
static $fetch_curl_used;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array<string, string|int> $parts
|
* @param array<string, string|int> $parts
|
||||||
|
|
Loading…
Reference in New Issue