From 85d91c82e8c75a12d75955246aef75888363bd17 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Jan 2023 17:34:51 +0100 Subject: [PATCH] Fix warning --- htdocs/comm/propal/class/propal.class.php | 16 ++++++++++++++-- htdocs/core/class/commonobject.class.php | 6 ++++++ htdocs/core/class/lessc.class.php | 10 +++++++++- htdocs/core/lib/company.lib.php | 2 ++ htdocs/fichinter/class/fichinter.class.php | 2 +- htdocs/fichinter/class/fichinterrec.class.php | 13 +++++-------- htdocs/theme/md/style.css.php | 2 +- qodana.yaml | 2 +- 8 files changed, 39 insertions(+), 14 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index a5fd221de87..57c066886ba 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -454,6 +454,8 @@ class Propal extends CommonObject $this->lines[] = $line; } + + return 1; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -2108,6 +2110,8 @@ class Propal extends CommonObject return -1 * $error; } } + + return -1; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -2164,6 +2168,8 @@ class Propal extends CommonObject return -1 * $error; } } + + return -1; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -2235,6 +2241,8 @@ class Propal extends CommonObject return -1 * $error; } } + + return -1; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -2417,9 +2425,9 @@ class Propal extends CommonObject $this->db->rollback(); return -1 * $error; } - } else { - return -1; } + + return -1; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -2480,6 +2488,8 @@ class Propal extends CommonObject return -1 * $error; } } + + return -1; } @@ -2542,6 +2552,8 @@ class Propal extends CommonObject return -1 * $error; } } + + return -1; } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 2a59fa4a9f5..cdf24741025 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3338,6 +3338,8 @@ abstract class CommonObject $row = $this->db->fetch_row($resql); return $row[0]; } + + return 0; } /** @@ -3361,6 +3363,8 @@ abstract class CommonObject $row = $this->db->fetch_row($resql); return $row[0]; } + + return 0; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -3406,6 +3410,8 @@ abstract class CommonObject return $row[0]; } } + + return 0; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps diff --git a/htdocs/core/class/lessc.class.php b/htdocs/core/class/lessc.class.php index d697a0eab91..1d581a07e7f 100644 --- a/htdocs/core/class/lessc.class.php +++ b/htdocs/core/class/lessc.class.php @@ -1011,6 +1011,7 @@ class Lessc if ($list[0] == "list" && isset($list[2][$idx - 1])) { return $list[2][$idx - 1]; } + return; } protected function lib_isnumber($value) @@ -1305,6 +1306,7 @@ class Lessc if (!is_null($color = $this->coerceColor($value))) { return isset($color[4]) ? $color[4] : 1; } + return; } // set the alpha of the color @@ -1835,6 +1837,7 @@ class Lessc } return null; } + return null; } // make something string like into a string @@ -1930,6 +1933,8 @@ class Lessc array_unshift($strRight[2], $left); return $strRight; } + + return ''; } @@ -1953,6 +1958,7 @@ class Lessc if ($op == '+' || $op == '*') { return $this->op_color_number($op, $rgt, $lft); } + return; } protected function op_color_number($op, $lft, $rgt) @@ -3133,7 +3139,7 @@ class lessc_parser } // an import statement - protected function import(&$out) + protected function import(&$out, $value = '') { if (!$this->literal('@import')) { return false; @@ -3147,6 +3153,8 @@ class lessc_parser $out = array("import", $value); return true; } + + return false; } protected function mediaQueryList(&$out) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index c863c802d4f..d49538f41dc 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -652,6 +652,8 @@ function getState($id, $withcode = '', $dbtouse = 0, $withregion = 0, $outputlan } else { dol_print_error($dbtouse, ''); } + + return ''; } /** diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 9f39c259ef8..1f191684d11 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -1300,7 +1300,7 @@ class Fichinter extends CommonObject */ public function initAsSpecimen() { - global $user, $langs, $conf; + global $langs; $now = dol_now(); diff --git a/htdocs/fichinter/class/fichinterrec.class.php b/htdocs/fichinter/class/fichinterrec.class.php index d1ab5fbee54..44dd63abcd2 100644 --- a/htdocs/fichinter/class/fichinterrec.class.php +++ b/htdocs/fichinter/class/fichinterrec.class.php @@ -661,18 +661,15 @@ class FichinterRec extends Fichinter * Used to build previews or test instances. * id must be 0 if object instance is a specimen. * - * @param string $option ''=Create a specimen fichinter with lines, 'nolines'=No lines * @return void */ - public function initAsSpecimen($option = '') + public function initAsSpecimen() { - global $user, $langs, $conf; + //$now = dol_now(); + //$arraynow = dol_getdate($now); + //$nownotime = dol_mktime(0, 0, 0, $arraynow['mon'], $arraynow['mday'], $arraynow['year']); - $now = dol_now(); - $arraynow = dol_getdate($now); - $nownotime = dol_mktime(0, 0, 0, $arraynow['mon'], $arraynow['mday'], $arraynow['year']); - - parent::initAsSpecimen($option); + parent::initAsSpecimen(); $this->usenewprice = 1; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 9a341e56b3b..a90e5e351a2 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -93,7 +93,7 @@ if (GETPOST('lang', 'aZ09')) { $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL } -if (GETPOSTISSET('THEME_DARKMODEENABLED', 'int')) { +if (GETPOSTISSET('THEME_DARKMODEENABLED')) { $conf->global->THEME_DARKMODEENABLED = GETPOST('THEME_DARKMODEENABLED', 'int'); // If darkmode was forced on URL } diff --git a/qodana.yaml b/qodana.yaml index 672be8ea928..adcc874ab0e 100644 --- a/qodana.yaml +++ b/qodana.yaml @@ -80,4 +80,4 @@ exclude: - name: PhpParameterNameChangedDuringInheritanceInspection - name: PhpDuplicateSwitchCaseBodyInspection - name: PhpNestedDirNameCallsCanBeReplacedWithLevelParameterInspection - + - name: PhpPointlessBooleanExpressionInConditionInspection