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
|
||||
class Db_Migrations {
|
||||
|
||||
private string $base_filename = "schema.sql";
|
||||
private string $base_path;
|
||||
private string $migrations_path;
|
||||
private string $migrations_table;
|
||||
private bool $base_is_latest;
|
||||
private \PDO $pdo;
|
||||
// TODO: class properties can be switched to PHP typing if/when the minimum PHP_VERSION is raised to 7.4.0+
|
||||
/** @var string */
|
||||
private $base_filename = "schema.sql";
|
||||
|
||||
private int $cached_version;
|
||||
private int $cached_max_version;
|
||||
private int $max_version_override;
|
||||
/** @var string */
|
||||
private $base_path;
|
||||
|
||||
/** @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() {
|
||||
$this->pdo = Db::pdo();
|
||||
|
|
|
@ -12,26 +12,44 @@ class Debug {
|
|||
Debug::LOG_EXTENDED,
|
||||
];
|
||||
|
||||
/** @deprecated */
|
||||
public static int $LOG_DISABLED = self::LOG_DISABLED;
|
||||
// TODO: class properties can be switched to PHP typing if/when the minimum PHP_VERSION is raised to 7.4.0+
|
||||
/**
|
||||
* @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;
|
||||
private static bool $quiet = false;
|
||||
private static ?string $logfile = null;
|
||||
/** @var bool */
|
||||
private static $enabled = false;
|
||||
|
||||
/** @var bool */
|
||||
private static $quiet = false;
|
||||
|
||||
/** @var string|null */
|
||||
private static $logfile = null;
|
||||
|
||||
/**
|
||||
* @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 {
|
||||
self::$logfile = $logfile;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?php
|
||||
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
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?php
|
||||
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
|
||||
|
|
|
@ -1,38 +1,49 @@
|
|||
<?php
|
||||
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 */
|
||||
private ?\Pdo $pdo_data = 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
|
||||
*
|
||||
* @var PDO|null
|
||||
*/
|
||||
private $pdo_data = null;
|
||||
|
||||
/** @var array<string, array<int, array<int, Plugin>>> hook types -> priority levels -> Plugins */
|
||||
private array $hooks = [];
|
||||
private $hooks = [];
|
||||
|
||||
/** @var array<string, Plugin> */
|
||||
private array $plugins = [];
|
||||
private $plugins = [];
|
||||
|
||||
/** @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 */
|
||||
private array $commands = [];
|
||||
private $commands = [];
|
||||
|
||||
/** @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}>> */
|
||||
private array $feeds = [];
|
||||
private $feeds = [];
|
||||
|
||||
/** @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}>> */
|
||||
private array $plugin_actions = [];
|
||||
private $plugin_actions = [];
|
||||
|
||||
private ?int $owner_uid = null;
|
||||
private bool $data_loaded = false;
|
||||
private static ?PluginHost $instance = null;
|
||||
/** @var int|null */
|
||||
private $owner_uid = null;
|
||||
|
||||
/** @var bool */
|
||||
private $data_loaded = false;
|
||||
|
||||
/** @var PluginHost|null */
|
||||
private static $instance = null;
|
||||
|
||||
const API_VERSION = 2;
|
||||
const PUBLIC_METHOD_DELIMITER = "--";
|
||||
|
|
|
@ -6,14 +6,30 @@ class UrlHelper {
|
|||
"tel"
|
||||
];
|
||||
|
||||
static string $fetch_last_error;
|
||||
static int $fetch_last_error_code;
|
||||
static string $fetch_last_error_content;
|
||||
static string $fetch_last_content_type;
|
||||
static string $fetch_last_modified;
|
||||
static string $fetch_effective_url;
|
||||
static string $fetch_effective_ip_addr;
|
||||
static bool $fetch_curl_used;
|
||||
// TODO: class properties can be switched to PHP typing if/when the minimum PHP_VERSION is raised to 7.4.0+
|
||||
/** @var string */
|
||||
static $fetch_last_error;
|
||||
|
||||
/** @var int */
|
||||
static $fetch_last_error_code;
|
||||
|
||||
/** @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
|
||||
|
|
Loading…
Reference in New Issue