fix phpstan (#32187)

* wip

* fix phpstan

* fix phpstan

* fix phpstan
This commit is contained in:
Frédéric FRANCE 2024-12-01 23:04:40 +01:00 committed by GitHub
parent 51c2e8973b
commit ea8f449d1d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 13 additions and 45 deletions

View file

@ -17988,39 +17988,9 @@ parameters:
count: 1
path: ../../htdocs/don/class/api_donations.class.php
-
message: '#^Call to function method_exists\(\) with \$this\(Don\) and ''LibStatut'' will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
count: 1
path: ../../htdocs/don/class/don.class.php
-
message: '#^Call to function method_exists\(\) with \$this\(Don\) and ''getNomUrl'' will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
count: 1
path: ../../htdocs/don/class/don.class.php
-
message: '#^Call to function property_exists\(\) with \$this\(Don\) and ''amount'' will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
count: 1
path: ../../htdocs/don/class/don.class.php
-
message: '#^Call to function property_exists\(\) with \$this\(Don\) and ''date'' will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
count: 1
path: ../../htdocs/don/class/don.class.php
-
message: '#^Call to function property_exists\(\) with \$this\(Don\) and ''societe'' will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
count: 2
path: ../../htdocs/don/class/don.class.php
-
message: '#^Negated boolean expression is always true\.$#'
identifier: booleanNot.alwaysTrue
count: 1
path: ../../htdocs/don/class/don.class.php

View file

@ -6,9 +6,9 @@
* Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2019 Thibault FOUCART <support@ptibogxiv.net>
* Copyright (C) 2019-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2021 Maxime DEMAREST <maxime@indelog.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2019-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2021 Maxime DEMAREST <maxime@indelog.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -594,7 +594,7 @@ class Don extends CommonObject
$this->db->begin();
if (!$error && !$notrigger) {
if (!$notrigger) {
// Call trigger
$result = $this->call_trigger('DON_DELETE', $user);
@ -1185,20 +1185,20 @@ class Don extends CommonObject
$return .= img_picto('', $this->picto);
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
$return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">' . $this->getNomUrl(1) . '</span>';
if ($selected >= 0) {
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
if (property_exists($this, 'date')) {
if (isDolTms($this->date)) {
$return .= ' &nbsp; | &nbsp; <span class="info-box-label">'.dol_print_date($this->date, 'day', 'tzuserrel').'</span>';
}
if (property_exists($this, 'societe') && !empty($this->societe)) {
if (!empty($this->societe)) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("Company").'</span> : <span class="info-box-label">'.$this->societe.'</span>';
}
if (property_exists($this, 'amount')) {
if (!empty($this->amount)) {
$return .= '<br><span class="info-box-label amount">'.price($this->amount, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
}
if (method_exists($this, 'LibStatut')) {
if (isset($this->status)) {
$return .= '<br><div class="info-box-status">'.$this->getLibStatut(3).'</div>';
}
$return .= '</div>';

View file

@ -469,6 +469,10 @@ while ($i < $imaxinloop) {
$obj = $db->fetch_object($resql);
$donationstatic->setVarsFromFetchObj($obj);
$donationstatic->id = $obj->rowid;
$donationstatic->ref = $obj->rowid;
$donationstatic->date = $db->jdate($obj->datedon);
$donationstatic->status = $obj->status;
$company = new Societe($db);
$result = $company->fetch($obj->socid);
@ -480,10 +484,6 @@ while ($i < $imaxinloop) {
}
// Output Kanban
$donationstatic->amount = $obj->amount;
$donationstatic->date = $obj->datedon;
$donationstatic->status = $obj->status;
$donationstatic->id = $obj->rowid;
$donationstatic->ref = $obj->rowid;
if (!empty($obj->socid) && $company->id > 0) {
$donationstatic->societe = $company->getNomUrl(1);
@ -506,8 +506,6 @@ while ($i < $imaxinloop) {
print '</td></tr>';
}
} else {
$donationstatic->id = $obj->rowid;
$donationstatic->ref = $obj->rowid;
$donationstatic->lastname = $obj->lastname;
$donationstatic->firstname = $obj->firstname;