From d82396db4ffd72eff4ccd17464af62607691cf70 Mon Sep 17 00:00:00 2001 From: William Desportes Date: Sun, 4 Jun 2023 10:21:24 +0200 Subject: [PATCH] src: fix phpdocs (#6599) --- .../OPNsense/CaptivePortal/Api/AccessController.php | 6 +++--- .../Diagnostics/Api/NetworkinsightController.php | 1 + .../OPNsense/IPsec/Api/KeyPairsController.php | 1 + .../OPNsense/OpenVPN/Api/ExportController.php | 1 - .../OPNsense/OpenVPN/Api/ServiceController.php | 1 - .../mvc/app/library/OPNsense/Core/Shell.php | 2 +- .../mvc/app/library/OPNsense/Firewall/Plugin.php | 1 + .../mvc/app/library/OPNsense/Firewall/Rule.php | 13 ++++++++----- .../mvc/app/library/OPNsense/Firewall/Util.php | 9 +++++---- .../mvc/app/library/OPNsense/Routing/Gateways.php | 4 +++- .../mvc/app/models/OPNsense/Base/Validation.php | 4 ++-- .../mvc/app/models/OPNsense/Monit/Monit.php | 4 ++-- .../mvc/app/models/OPNsense/OpenVPN/OpenVPN.php | 1 + .../models/OPNsense/TrafficShaper/TrafficShaper.php | 2 -- 14 files changed, 28 insertions(+), 22 deletions(-) diff --git a/src/opnsense/mvc/app/controllers/OPNsense/CaptivePortal/Api/AccessController.php b/src/opnsense/mvc/app/controllers/OPNsense/CaptivePortal/Api/AccessController.php index 8bd41ed06..fc84fdd10 100644 --- a/src/opnsense/mvc/app/controllers/OPNsense/CaptivePortal/Api/AccessController.php +++ b/src/opnsense/mvc/app/controllers/OPNsense/CaptivePortal/Api/AccessController.php @@ -120,7 +120,7 @@ class AccessController extends ApiControllerBase /** * logon client to zone, must use post type of request - * @param int|string zone id number + * @param int|string $zoneid zone id number * @return array * @throws \OPNsense\Base\ModelException */ @@ -229,7 +229,7 @@ class AccessController extends ApiControllerBase /** * logoff client - * @param int|string zone id number + * @param int|string $zoneid zone id number * @return array * @throws \OPNsense\Base\ModelException */ @@ -266,7 +266,7 @@ class AccessController extends ApiControllerBase /** * retrieve session info - * @param int|string zone id number + * @param int|string $zoneid zone id number * @return array * @throws \OPNsense\Base\ModelException */ diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/NetworkinsightController.php b/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/NetworkinsightController.php index d3b7596cf..079e31d58 100644 --- a/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/NetworkinsightController.php +++ b/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/NetworkinsightController.php @@ -50,6 +50,7 @@ class NetworkinsightController extends ApiControllerBase * @param string $to_date to timestamp * @param string $resolution resolution in seconds * @param string $field field name to aggregate + * @param null $emulation * @return array timeseries */ public function timeserieAction( diff --git a/src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/KeyPairsController.php b/src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/KeyPairsController.php index f0e7fc8dc..29db5487d 100644 --- a/src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/KeyPairsController.php +++ b/src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/KeyPairsController.php @@ -116,6 +116,7 @@ class KeyPairsController extends ApiMutableModelControllerBase /** * Generate keypair * @param string $type (rsa, ecdsa) + * @param string $size The key size in bytes * @return array */ public function genKeyPairAction($type, $size = null) diff --git a/src/opnsense/mvc/app/controllers/OPNsense/OpenVPN/Api/ExportController.php b/src/opnsense/mvc/app/controllers/OPNsense/OpenVPN/Api/ExportController.php index 568e39462..1156de4be 100644 --- a/src/opnsense/mvc/app/controllers/OPNsense/OpenVPN/Api/ExportController.php +++ b/src/opnsense/mvc/app/controllers/OPNsense/OpenVPN/Api/ExportController.php @@ -306,7 +306,6 @@ class ExportController extends ApiControllerBase * download configuration * @param string $vpnid server handle * @param string $certref certificate to export if applicable - * @param null $config * @return array * @throws \OPNsense\Base\ModelException * @throws UserException when invalid user input diff --git a/src/opnsense/mvc/app/controllers/OPNsense/OpenVPN/Api/ServiceController.php b/src/opnsense/mvc/app/controllers/OPNsense/OpenVPN/Api/ServiceController.php index 6b9bbfa51..82fd52bc1 100644 --- a/src/opnsense/mvc/app/controllers/OPNsense/OpenVPN/Api/ServiceController.php +++ b/src/opnsense/mvc/app/controllers/OPNsense/OpenVPN/Api/ServiceController.php @@ -239,7 +239,6 @@ class ServiceController extends ApiControllerBase } /** - * @param int $id server/client id to restart * @return array */ public function reconfigureAction() diff --git a/src/opnsense/mvc/app/library/OPNsense/Core/Shell.php b/src/opnsense/mvc/app/library/OPNsense/Core/Shell.php index a9b9ee547..016c99360 100644 --- a/src/opnsense/mvc/app/library/OPNsense/Core/Shell.php +++ b/src/opnsense/mvc/app/library/OPNsense/Core/Shell.php @@ -61,7 +61,7 @@ class Shell /** * execute command or list of commands * - * @param string/array $command command to execute + * @param string|array $command command to execute * @param bool $mute * @param array &$output */ diff --git a/src/opnsense/mvc/app/library/OPNsense/Firewall/Plugin.php b/src/opnsense/mvc/app/library/OPNsense/Firewall/Plugin.php index 2f183ffc5..8cc0c4a68 100644 --- a/src/opnsense/mvc/app/library/OPNsense/Firewall/Plugin.php +++ b/src/opnsense/mvc/app/library/OPNsense/Firewall/Plugin.php @@ -211,6 +211,7 @@ class Plugin * @param string $type anchor type (fw for filter, other options are nat,rdr,binat) * @param string $priority sort order from low to high * @param string $placement placement head,tail + * @param bool $quick * @return null */ public function registerAnchor($name, $type = "fw", $priority = 0, $placement = "tail", $quick = false) diff --git a/src/opnsense/mvc/app/library/OPNsense/Firewall/Rule.php b/src/opnsense/mvc/app/library/OPNsense/Firewall/Rule.php index c9a124ac9..40f81a43f 100644 --- a/src/opnsense/mvc/app/library/OPNsense/Firewall/Rule.php +++ b/src/opnsense/mvc/app/library/OPNsense/Firewall/Rule.php @@ -51,7 +51,7 @@ abstract class Rule /** * send text to debug log - * @param string debug log info + * @param string $line debug log info */ protected function log($line) { @@ -142,6 +142,8 @@ abstract class Rule * parse data, use replace map * @param string $value field value * @param string $map + * @param string $prefix + * @param string $suffix * @return string */ protected function parseReplaceSimple($value, $map, $prefix = "", $suffix = "") @@ -163,8 +165,8 @@ abstract class Rule /** * rule reader, applies standard rule patterns - * @param string type of rule to be read - * @return iterator rules to generate + * @param string $type type of rule to be read + * @return \Iterator rules to generate */ protected function reader($type = null) { @@ -201,8 +203,8 @@ abstract class Rule /** * parse rule to text using processing parameters in $procorder - * @param array conversion properties (rule keys and methods to execute) - * @param array rule to parse + * @param array $procorder conversion properties (rule keys and methods to execute) + * @param array $rule rule to parse * @return string */ protected function ruleToText(&$procorder, &$rule) @@ -316,6 +318,7 @@ abstract class Rule * parse interface (name to interface) * @param string|array $value field value * @param string $prefix prefix interface tag + * @param string $suffix suffix interface tag * @return string */ protected function parseInterface($value, $prefix = "on ", $suffix = "") diff --git a/src/opnsense/mvc/app/library/OPNsense/Firewall/Util.php b/src/opnsense/mvc/app/library/OPNsense/Firewall/Util.php index 58bca1317..d629a0c84 100644 --- a/src/opnsense/mvc/app/library/OPNsense/Firewall/Util.php +++ b/src/opnsense/mvc/app/library/OPNsense/Firewall/Util.php @@ -54,7 +54,7 @@ class Util /** * is provided address an ip address. - * @param string $network address + * @param string $address network address * @return boolean */ public static function isIpAddress($address) @@ -64,7 +64,7 @@ class Util /** * is provided address a mac address. - * @param string $network address + * @param string $address network address * @return boolean */ public static function isMACAddress($address) @@ -321,7 +321,7 @@ class Util /** * calculate rule hash value - * @param array rule + * @param array $rule * @return string */ public static function calcRuleHash($rule) @@ -351,7 +351,8 @@ class Util /** * Find the smallest possible subnet mask for given IP range - * @param array ips (start, end) + * @param array $ips (start, end) + * @param string $family inet6 or inet * @return int smallest mask */ public static function smallestCIDR($ips, $family = 'inet') diff --git a/src/opnsense/mvc/app/library/OPNsense/Routing/Gateways.php b/src/opnsense/mvc/app/library/OPNsense/Routing/Gateways.php index 56a6af29e..ae4c513d7 100644 --- a/src/opnsense/mvc/app/library/OPNsense/Routing/Gateways.php +++ b/src/opnsense/mvc/app/library/OPNsense/Routing/Gateways.php @@ -100,7 +100,7 @@ class Gateways /** * return the device name present in the system for the specific configuration * @param string $ifname name of the interface - * @param array $ifcfg configuration of interface + * @param array $definedIntf configuration of interface * @param string $ipproto inet/inet6 type * @return string $realif target device name */ @@ -398,6 +398,7 @@ class Gateways * determine default gateway, exclude gateways in skip list * @param bool $disabled return disabled gateways * @param bool $localhost inet/inet6 type + * @param bool $inactive is inactive * @return string type name */ public function gatewaysIndexedByName($disabled = false, $localhost = false, $inactive = false) @@ -483,6 +484,7 @@ class Gateways * @param string $interface interface name * @param string $ipproto inet/inet6 * @param boolean $only_configured only return configured in interface or dynamic gateways + * @param string $property the gateway property * @return string|null gateway address */ public function getInterfaceGateway($interface, $ipproto = "inet", $only_configured = false, $property = 'gateway') diff --git a/src/opnsense/mvc/app/models/OPNsense/Base/Validation.php b/src/opnsense/mvc/app/models/OPNsense/Base/Validation.php index ed8e90453..0cf89c863 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Base/Validation.php +++ b/src/opnsense/mvc/app/models/OPNsense/Base/Validation.php @@ -56,7 +56,7 @@ class Validation /** * Adds a validator to a field * - * @param string|array $field + * @param string|array $key * @param BaseValidator|ValidatorInterface $validator * * @return Validation @@ -77,7 +77,7 @@ class Validation /** * Validate a set of data according to a set of rules * - * @param array data + * @param array $data */ public function validate($data) { diff --git a/src/opnsense/mvc/app/models/OPNsense/Monit/Monit.php b/src/opnsense/mvc/app/models/OPNsense/Monit/Monit.php index 1bcfaeabd..bde0072ca 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Monit/Monit.php +++ b/src/opnsense/mvc/app/models/OPNsense/Monit/Monit.php @@ -345,7 +345,7 @@ class Monit extends BaseModel /** * determine if services have links to this test node - * @param uuid of the test node + * @param string $testUUID uuid of the test node * @return bool */ public function isTestServiceRelated($testUUID = null) @@ -361,7 +361,7 @@ class Monit extends BaseModel /** * get test type from condition string - * @param condition string + * @param string $condition condition string * @return string */ public function getTestType($condition) diff --git a/src/opnsense/mvc/app/models/OPNsense/OpenVPN/OpenVPN.php b/src/opnsense/mvc/app/models/OPNsense/OpenVPN/OpenVPN.php index 45ebc97ee..9be8393c0 100644 --- a/src/opnsense/mvc/app/models/OPNsense/OpenVPN/OpenVPN.php +++ b/src/opnsense/mvc/app/models/OPNsense/OpenVPN/OpenVPN.php @@ -229,6 +229,7 @@ class OpenVPN extends BaseModel * Find unique instance properties, either from legacy or mvc model * Offers glue between both worlds. * @param string $server_id vpnid (either numerical or uuid) + * @param string $role the node role * @return array selection of relevant fields for downstream processes */ public function getInstanceById($server_id, $role = null) diff --git a/src/opnsense/mvc/app/models/OPNsense/TrafficShaper/TrafficShaper.php b/src/opnsense/mvc/app/models/OPNsense/TrafficShaper/TrafficShaper.php index 926d2d87e..fe8370628 100644 --- a/src/opnsense/mvc/app/models/OPNsense/TrafficShaper/TrafficShaper.php +++ b/src/opnsense/mvc/app/models/OPNsense/TrafficShaper/TrafficShaper.php @@ -106,7 +106,6 @@ class TrafficShaper extends BaseModel /** * Generate a new pipe number * The first 10000 id's are automatically reserved for internal usage. - * @param null $pipenr new pipe number * @return ArrayField */ public function newPipeNumber() @@ -122,7 +121,6 @@ class TrafficShaper extends BaseModel /** * Generate a new queue number * The first 10000 id's are automatically reserved for internal usage. - * @param null $queuenr new queue number * @return ArrayField */ public function newQueueNumber()