From eda4b0cd85050cb9369c3325aa9a8fc2679ba108 Mon Sep 17 00:00:00 2001 From: thibdrev Date: Mon, 29 Jan 2024 08:55:26 +0100 Subject: [PATCH] qual: phpstan for htdocs/accountancy/class/bookkeeping.class.php htdocs/accountancy/class/bookkeeping.class.php 1833 Method BookKeeping::getNextNumMvt() should return int but returns string. htdocs/accountancy/class/bookkeeping.class.php 2268 Method BookKeeping::getCanModifyBookkeepingSQL() should return string but returns null. htdocs/accountancy/class/bookkeeping.class.php 2624 Method BookKeeping::accountingResult() should return string but returns (float|int). htdocs/accountancy/class/bookkeeping.class.php 2764 Property BookKeeping::$date_lim_reglement (int) does not accept string. htdocs/accountancy/class/bookkeeping.class.php 2811 Property BookKeeping::$date_lim_reglement (int) does not accept string. --- htdocs/accountancy/class/bookkeeping.class.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index fc3967f022537..99acd49f0ba21 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1802,10 +1802,10 @@ public function fetchPerMvt($piecenum, $mode = '') } /** - * Return next number movement + * Return next movement number * - * @param string $mode Mode - * @return int Return integer <0 if KO, >0 if OK (Next numero to use) + * @param string $mode Mode + * @return int<1, max>|-1 Return next movement number or -1 if error */ public function getNextNumMvt($mode = '') { @@ -1830,7 +1830,7 @@ public function getNextNumMvt($mode = '') } else { $this->error = "Error ".$this->db->lasterror(); dol_syslog(get_class($this)."::getNextNumMvt ".$this->error, LOG_ERR); - return "-1"; + return -1; } } @@ -2253,7 +2253,7 @@ public function get_compte_desc($account = null) * * @param string $alias Bookkeeping alias table * @param bool $force Force reload - * @return string SQL filter + * @return string|null SQL filter or null if error */ public function getCanModifyBookkeepingSQL($alias = '', $force = false) { @@ -2621,7 +2621,7 @@ public function accountingResult($date_start, $date_end) } } - return $income_statement_amount; + return (string) $income_statement_amount; } /** @@ -2761,7 +2761,7 @@ public function closeFiscalPeriod($fiscal_period_id, $new_fiscal_period_id, $sep $bookkeeping = new BookKeeping($this->db); $bookkeeping->doc_date = $new_fiscal_period->date_start; - $bookkeeping->date_lim_reglement = (string) ''; + $bookkeeping->date_lim_reglement = 0; $bookkeeping->doc_ref = $new_fiscal_period->label; $bookkeeping->date_creation = $now; $bookkeeping->doc_type = 'closure'; @@ -2808,7 +2808,7 @@ public function closeFiscalPeriod($fiscal_period_id, $new_fiscal_period_id, $sep $bookkeeping = new BookKeeping($this->db); $bookkeeping->doc_date = $new_fiscal_period->date_start; - $bookkeeping->date_lim_reglement = (string) ''; + $bookkeeping->date_lim_reglement = 0; $bookkeeping->doc_ref = $new_fiscal_period->label; $bookkeeping->date_creation = $now; $bookkeeping->doc_type = 'closure';