diff --git a/phpstan.neon b/phpstan.neon
index 2a83bf6..b999b4e 100644
--- a/phpstan.neon
+++ b/phpstan.neon
@@ -1,4 +1,4 @@
parameters:
- level: 5
+ level: 6
paths:
- src
\ No newline at end of file
diff --git a/src/usr/local/emhttp/plugins/tailscale/include/common/get-config.php b/src/usr/local/emhttp/plugins/tailscale/include/common/get-config.php
index 6d63d42..9fa0184 100644
--- a/src/usr/local/emhttp/plugins/tailscale/include/common/get-config.php
+++ b/src/usr/local/emhttp/plugins/tailscale/include/common/get-config.php
@@ -1,6 +1,10 @@
+ */
+function getPluginConfig() : array
+{
$config_file = '/boot/config/plugins/tailscale/tailscale.cfg';
$defaults_file = '/usr/local/emhttp/plugins/tailscale/settings.json';
diff --git a/src/usr/local/emhttp/plugins/tailscale/include/common/gro-ethtool.php b/src/usr/local/emhttp/plugins/tailscale/include/common/gro-ethtool.php
index bcbc416..18fe97a 100644
--- a/src/usr/local/emhttp/plugins/tailscale/include/common/gro-ethtool.php
+++ b/src/usr/local/emhttp/plugins/tailscale/include/common/gro-ethtool.php
@@ -1,6 +1,6 @@
+ */
+function run_command(string $command, bool $alwaysShow = false, bool $show = true) : array
{
$output = array();
$retval = null;
diff --git a/src/usr/local/emhttp/plugins/tailscale/include/common/tailscale-status.php b/src/usr/local/emhttp/plugins/tailscale/include/common/tailscale-status.php
index c494f1a..dbb0314 100644
--- a/src/usr/local/emhttp/plugins/tailscale/include/common/tailscale-status.php
+++ b/src/usr/local/emhttp/plugins/tailscale/include/common/tailscale-status.php
@@ -1,18 +1,18 @@
$content
+ */
+function send_usage(string $url, array $content) : int
{
$body = json_encode($content);
$token = download_url($url . '?connect');
diff --git a/src/usr/local/emhttp/plugins/tailscale/include/get_log.php b/src/usr/local/emhttp/plugins/tailscale/include/get_log.php
index 77f92b1..718e8c2 100644
--- a/src/usr/local/emhttp/plugins/tailscale/include/get_log.php
+++ b/src/usr/local/emhttp/plugins/tailscale/include/get_log.php
@@ -1,6 +1,6 @@
', htmlspecialchars($e->getMessage()), "";
}
diff --git a/src/usr/local/emhttp/plugins/tailscale/include/netbios-check.php b/src/usr/local/emhttp/plugins/tailscale/include/netbios-check.php
index 74e8ed7..bfdb648 100644
--- a/src/usr/local/emhttp/plugins/tailscale/include/netbios-check.php
+++ b/src/usr/local/emhttp/plugins/tailscale/include/netbios-check.php
@@ -1,6 +1,9 @@
$var
+ */
+function getTailscaleNetbiosWarning(array $var) : string
{
if (($var['USE_NETBIOS'] == "yes") && ($var['shareSMBEnabled'] != "no")) {
return "" . _tr("warnings.netbios") . "";
diff --git a/src/usr/local/emhttp/plugins/tailscale/include/set-tailscale-interface.php b/src/usr/local/emhttp/plugins/tailscale/include/set-tailscale-interface.php
index ef3a56a..f586314 100644
--- a/src/usr/local/emhttp/plugins/tailscale/include/set-tailscale-interface.php
+++ b/src/usr/local/emhttp/plugins/tailscale/include/set-tailscale-interface.php
@@ -24,10 +24,10 @@
if ($in_array != $tailscale_config["INCLUDE_INTERFACE"]) {
if ($tailscale_config["INCLUDE_INTERFACE"]) {
$include_array[] = $ifname;
- logmsg("{$ifname} added to include_interfaces", LOG_NOTICE);
+ logmsg("{$ifname} added to include_interfaces");
} else {
$include_array = array_diff($include_array, [$ifname]);
- logmsg("{$ifname} removed from include_interfaces", LOG_NOTICE);
+ logmsg("{$ifname} removed from include_interfaces");
}
$write_file = true;
}
@@ -42,5 +42,5 @@
END;
file_put_contents($network_extra_file, $file);
- logmsg("Updated network-extra.cfg", LOG_NOTICE);
+ logmsg("Updated network-extra.cfg");
}
diff --git a/src/usr/local/emhttp/plugins/tailscale/include/tailscale-lock.php b/src/usr/local/emhttp/plugins/tailscale/include/tailscale-lock.php
index fa31b55..c51793c 100644
--- a/src/usr/local/emhttp/plugins/tailscale/include/tailscale-lock.php
+++ b/src/usr/local/emhttp/plugins/tailscale/include/tailscale-lock.php
@@ -1,11 +1,11 @@
Enabled;
}
-function getTailscaleLockSigned($lock)
+function getTailscaleLockSigned(object $lock) : bool
{
if ( ! getTailscaleLockEnabled($lock)) {
return false;
@@ -14,25 +14,25 @@ function getTailscaleLockSigned($lock)
return $lock->NodeKeySigned;
}
-function getTailscaleLockNodekey($lock)
+function getTailscaleLockNodekey(object $lock) : string
{
if ( ! getTailscaleLockEnabled($lock)) {
- return false;
+ return "";
}
return $lock->NodeKey;
}
-function getTailscaleLockPubkey($lock)
+function getTailscaleLockPubkey(object $lock) : string
{
if ( ! getTailscaleLockEnabled($lock)) {
- return false;
+ return "";
}
return $lock->PublicKey;
}
-function getTailscaleLockSigning($lock)
+function getTailscaleLockSigning(object $lock) : bool
{
if ( ! getTailscaleLockSigned($lock)) {
return false;
@@ -50,7 +50,10 @@ function getTailscaleLockSigning($lock)
return $isTrusted;
}
-function getTailscaleLockPending($lock)
+/**
+ * @return array
+ */
+function getTailscaleLockPending(object $lock) : array
{
if ( ! getTailscaleLockSigning($lock)) {
return array();
@@ -65,7 +68,7 @@ function getTailscaleLockPending($lock)
return $pending;
}
-function getTailscaleLockWarning($lock)
+function getTailscaleLockWarning(object $lock) : string
{
if (getTailscaleLockEnabled($lock) && ( ! getTailscaleLockSigned($lock))) {
return "" . _tr("warnings.lock") . "";
diff --git a/src/usr/local/emhttp/plugins/tailscale/include/tailscale-watcher/on-ip/apply-settings.php b/src/usr/local/emhttp/plugins/tailscale/include/tailscale-watcher/on-ip/apply-settings.php
index 5dd9c3a..28b64bb 100644
--- a/src/usr/local/emhttp/plugins/tailscale/include/tailscale-watcher/on-ip/apply-settings.php
+++ b/src/usr/local/emhttp/plugins/tailscale/include/tailscale-watcher/on-ip/apply-settings.php
@@ -1,6 +1,6 @@
{$title} | {$value} | " . PHP_EOL;
}
-function printDash($title, $value)
+function printDash(string $title, string $value) : string
{
return "{$title}{$value} |
" . PHP_EOL;
}
-function getStatusInfo($status, $prefs, $lock)
+function getStatusInfo(object $status, object $prefs, object $lock) : string
{
$tsVersion = isset($status->Version) ? $status->Version : _tr("unknown");
$keyExpiration = isset($status->Self->KeyExpiry) ? $status->Self->KeyExpiry : _tr("disabled");
@@ -48,7 +48,7 @@ function getStatusInfo($status, $prefs, $lock)
return $output;
}
-function getConnectionInfo($status, $prefs)
+function getConnectionInfo(object $status, object $prefs) : string
{
$hostName = isset($status->Self->HostName) ? $status->Self->HostName : _tr("unknown");
$dnsName = isset($status->Self->DNSName) ? $status->Self->DNSName : _tr("unknown");
@@ -70,7 +70,7 @@ function getConnectionInfo($status, $prefs)
return $output;
}
-function getDashboardInfo($status)
+function getDashboardInfo(object $status) : string
{
$hostName = isset($status->Self->HostName) ? $status->Self->HostName : _tr("Unknown");
$dnsName = isset($status->Self->DNSName) ? $status->Self->DNSName : _tr("Unknown");
diff --git a/src/usr/local/emhttp/plugins/tailscale/include/webgui-key-expiration.php b/src/usr/local/emhttp/plugins/tailscale/include/webgui-key-expiration.php
index 7f621e1..1150d2f 100644
--- a/src/usr/local/emhttp/plugins/tailscale/include/webgui-key-expiration.php
+++ b/src/usr/local/emhttp/plugins/tailscale/include/webgui-key-expiration.php
@@ -1,6 +1,6 @@
Self->KeyExpiry)) {
$expiryTime = new DateTime($status->Self->KeyExpiry);