This commit is contained in:
Daniel
2025-03-10 16:44:42 +08:00
committed by GitHub
parent a0f179a7e7
commit e9d3de0c25
5 changed files with 10 additions and 10 deletions

View File

@@ -44,7 +44,7 @@ abstract class ApiParameter
* *
* @throws Exception * @throws Exception
*/ */
public function __construct(array $params = null) public function __construct(?array $params = null)
{ {
if (!is_null($params)) { if (!is_null($params)) {
$params = $this->trimArray($params); $params = $this->trimArray($params);
@@ -91,7 +91,7 @@ abstract class ApiParameter
* @return mixed * @return mixed
* @throws Exception * @throws Exception
*/ */
protected function getUlParam(string $param = null, string $ul_field = null, bool $optional = false, $default = 0) protected function getUlParam(?string $param = null, ?string $ul_field = null, bool $optional = false, $default = 0)
{ {
$param_value = (int)$this->getParam($param, $optional, $default); $param_value = (int)$this->getParam($param, $optional, $default);
$ul_field_value = $this->getBoolParam($ul_field, true, 0); $ul_field_value = $this->getBoolParam($ul_field, true, 0);
@@ -116,7 +116,7 @@ abstract class ApiParameter
* @return mixed * @return mixed
* @throws Exception * @throws Exception
*/ */
protected function getParam(string $param = null, bool $optional = false, $default = '') protected function getParam(?string $param = null, bool $optional = false, $default = '')
{ {
// does it exist? // does it exist?
if (!isset($this->cmd_params[$param])) { if (!isset($this->cmd_params[$param])) {
@@ -183,7 +183,7 @@ abstract class ApiParameter
* *
* @return string * @return string
*/ */
protected function getBoolParam(string $param = null, bool $optional = false, $default = false) protected function getBoolParam(?string $param = null, bool $optional = false, $default = false)
{ {
$_default = '0'; $_default = '0';
if ($default) { if ($default) {

View File

@@ -133,7 +133,7 @@ class Database
* if set to false, the error will be logged, but we go on * if set to false, the error will be logged, but we go on
* @throws Exception * @throws Exception
*/ */
private static function showerror(Exception $error, bool $showerror = true, bool $json_response = false, PDOStatement $stmt = null) private static function showerror(Exception $error, bool $showerror = true, bool $json_response = false, ?PDOStatement $stmt = null)
{ {
global $userinfo, $theme, $linker; global $userinfo, $theme, $linker;

View File

@@ -164,7 +164,7 @@ class FroxlorLogger
* @param int $type * @param int $type
* @param ?string $text * @param ?string $text
*/ */
public function logAction($action = FroxlorLogger::USR_ACTION, int $type = LOG_NOTICE, string $text = null) public function logAction($action = FroxlorLogger::USR_ACTION, int $type = LOG_NOTICE, ?string $text = null)
{ {
// not logging normal stuff if not set to "paranoid" logging // not logging normal stuff if not set to "paranoid" logging
if (!self::$crondebug_flag && Settings::Get('logger.severity') == '1' && $type > LOG_NOTICE) { if (!self::$crondebug_flag && Settings::Get('logger.severity') == '1' && $type > LOG_NOTICE) {

View File

@@ -199,7 +199,7 @@ class PhpHelper
* @param string|null $nameserver set additional resolver nameserver to use (e.g. 1.1.1.1) * @param string|null $nameserver set additional resolver nameserver to use (e.g. 1.1.1.1)
* @return bool|array * @return bool|array
*/ */
public static function gethostbynamel6(string $host, bool $try_a = true, string $nameserver = null) public static function gethostbynamel6(string $host, bool $try_a = true, ?string $nameserver = null)
{ {
$ips = []; $ips = [];
@@ -442,7 +442,7 @@ class PhpHelper
* @param bool $asReturn * @param bool $asReturn
* @return string * @return string
*/ */
public static function parseArrayToPhpFile(array $array, string $comment = null, bool $asReturn = false): string public static function parseArrayToPhpFile(array $array, ?string $comment = null, bool $asReturn = false): string
{ {
$str = sprintf("<?php\n// %s\n\n", $comment ?? 'autogenerated froxlor file'); $str = sprintf("<?php\n// %s\n\n", $comment ?? 'autogenerated froxlor file');
@@ -464,7 +464,7 @@ class PhpHelper
* @param int $depth * @param int $depth
* @return string * @return string
*/ */
public static function parseArrayToString(array $array, string $key = null, int $depth = 1): string public static function parseArrayToString(array $array, ?string $key = null, int $depth = 1): string
{ {
$str = ''; $str = '';
if (!is_null($key)) { if (!is_null($key)) {

View File

@@ -162,7 +162,7 @@ class Pagination
* *
* @return Pagination * @return Pagination
*/ */
public function addSearch(string $searchtext = null, string $field = null, string $operator = null): Pagination public function addSearch(?string $searchtext = null, string $field = null, string $operator = null): Pagination
{ {
if (!isset($this->data['sql_search'])) { if (!isset($this->data['sql_search'])) {
$this->data['sql_search'] = []; $this->data['sql_search'] = [];