diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index d8806427808e7..027b03a0df4bc 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -27870,12 +27870,6 @@ parameters: count: 1 path: ../../htdocs/product/stock/movement_list.php - - - message: '#^Variable \$whClass might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/product/stock/movement_list.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index ca2060ac4b207..6454ef43b84f8 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -231,12 +231,6 @@ class Asset extends CommonObject */ public $status; - /** - * @var static object oldcopy - */ - public $oldcopy; - - /** * @var AssetDepreciationOptions Used for computed fields of depreciation options class. */ diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index ac6d62da82cfd..57e8bb3b0b9b2 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -122,11 +122,6 @@ class Propal extends CommonObject */ public $ref_customer; - /** - * @var static oldcopy with propal properties - */ - public $oldcopy; - /** * Status of the quote * @var int diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index e63c86551cc69..7f7eb71398b8c 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -248,11 +248,6 @@ class Facture extends CommonInvoice */ public $tab_next_situation_invoice = array(); - /** - * @var static object oldcopy - */ - public $oldcopy; - /** * @var float percentage of retainage */ diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 5fc553e999434..410ea6093183a 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -343,13 +343,6 @@ class Contact extends CommonObject public $ip; // END MODULEBUILDER PROPERTIES - - /** - * Old copy - * @var static - */ - public $oldcopy; // To contain a clone of this when we need to save old properties of object - /** * @var array roles */ diff --git a/htdocs/core/class/comment.class.php b/htdocs/core/class/comment.class.php index c1e3f61379d23..9bb732e0a4269 100644 --- a/htdocs/core/class/comment.class.php +++ b/htdocs/core/class/comment.class.php @@ -76,11 +76,6 @@ class Comment extends CommonObject public $comments = array(); - /** - * @var static Object oldcopy - */ - public $oldcopy; - /** * Constructor diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 66f9af18511e1..8fe7db58b7281 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -177,7 +177,7 @@ abstract class CommonObject private $linkedObjectsFullLoaded = array(); /** - * @var ?mixed To store a cloned copy of the object before editing it (to keep track of its former properties) + * @var ?static To store a cloned copy of the object before editing it (to keep track of its former properties) */ public $oldcopy; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 0eff9ebfbd320..558a6e285b6b0 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -71,11 +71,6 @@ class Product extends CommonObject */ public $fk_element = 'fk_product'; - /** - * @var static - */ - public $oldcopy; - /** * @var array> List of child tables. To test if we can delete object. */ diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index 61e7daeef71e5..86bd74c950343 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -848,7 +848,6 @@ public function createFromClone(User $user, $fromid) */ public function loadStatsExpedition($socid = 0) { - // phpcs:enable global $user, $hookmanager, $action; $sql = "SELECT COUNT(DISTINCT exp.fk_soc) as nb_customers, COUNT(DISTINCT exp.rowid) as nb,"; @@ -923,7 +922,6 @@ public function loadStatsExpedition($socid = 0) */ public function loadStatsSupplierOrder($socid = 0) { - // phpcs:enable global $user, $hookmanager, $action; $sql = "SELECT COUNT(DISTINCT cf.fk_soc) as nb_customers, COUNT(DISTINCT cf.rowid) as nb,"; @@ -998,7 +996,6 @@ public function loadStatsSupplierOrder($socid = 0) */ public function loadStatsReception($socid = 0) { - // phpcs:enable global $user, $hookmanager, $action; $sql = "SELECT COUNT(DISTINCT recep.fk_soc) as nb_customers, COUNT(DISTINCT recep.rowid) as nb,"; @@ -1072,7 +1069,6 @@ public function loadStatsReception($socid = 0) */ public function loadStatsMo($socid = 0) { - // phpcs:enable global $user, $hookmanager, $action; $error = 0; diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index 86986da7ed437..e5cabbe26d51b 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -333,8 +333,7 @@ } if ($action == 'update_extras' && $permissiontoadd) { - $whClass = get_class($whClass); - $whClass::$oldcopy = dol_clone($tmpwarehouse, 2); + $tmpwarehouse->oldcopy = dol_clone($tmpwarehouse, 2); // @phan-suppress-current-line PhanTypeMismatchProperty // Fill array 'array_options' with data from update form $ret = $extrafields->setOptionalsFromPost(null, $tmpwarehouse, GETPOST('attribute', 'restricthtml')); diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index d1cdb65323498..993e6a07e68bc 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -246,11 +246,6 @@ class Project extends CommonObject */ public $email_msgid; - /** - * @var ?static - */ - public $oldcopy; - /** * @var array Used to store workload details of a projet (array[day]) */ diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index aef2adf13efc0..6549601154234 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1707,7 +1707,7 @@ } // - If a new amount was posted from the form if ($caneditamount && GETPOSTISSET('newamount') && GETPOSTFLOAT('newamount', 'MT') > 0) { - $amount = GETPOSTFLOAT('newamount', 'MT'); + $amount = GETPOSTFLOAT('newamount', 'MT'); } // - If a min is set or an amount from the posted form, we take them into account $amount = max(0, (float) $amount, (float) getDolGlobalInt("MEMBER_MIN_AMOUNT")); diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index 40955b2f77c31..75a96e391f61c 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -131,11 +131,6 @@ class Dolresource extends CommonObject */ public $cache_code_type_resource; - /** - * @var static Clone of object before changing it - */ - public $oldcopy; - /** * Constructor diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 5c244c10b62e2..e1e66ac6edfe1 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -133,11 +133,6 @@ class Societe extends CommonObject */ public $restrictiononfksoc = 1; - /** - * @var static To store a cloned copy of object before to edit it and keep track of old properties - */ - public $oldcopy; - /** * array of supplier categories * @var string[] diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 5e3dfee76c3a7..595943b584568 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -177,7 +177,7 @@ } if (!$error) { - $companybankaccount->oldcopy = dol_clone($companybankaccount, 2); + $companybankaccount->oldcopy = dol_clone($companybankaccount, 2); // @phan-suppress-current-line PhanTypeMismatchProperty $companybankaccount->socid = $object->id; @@ -254,7 +254,7 @@ $companypaymentmode->fetch($id); if (!$error) { - $companypaymentmode->oldcopy = dol_clone($companypaymentmode, 2); + $companypaymentmode->oldcopy = dol_clone($companypaymentmode, 2); // @phan-suppress-current-line PhanTypeMismatchProperty $companypaymentmode->fk_soc = $object->id; @@ -311,7 +311,7 @@ // Ajout $companybankaccount = new CompanyBankAccount($db); - $companybankaccount->socid = $object->id; + $companybankaccount->socid = $object->id; $companybankaccount->fetch_thirdparty(); diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 848abcb41517b..56cfb53ef9a94 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -246,17 +246,11 @@ class Ticket extends CommonObject */ public $ip; - /** - * @var static Save the ticket before an update operation (for triggers) - */ - public $oldcopy; - /** * @var Ticket[] Array of Tickets */ public $lines; - /** * @var string Regex pour les images */ diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index f0b2ea132fa83..975cbefb98aeb 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -75,11 +75,6 @@ class User extends CommonObject */ public $id = 0; - /** - * @var static old copy of User - */ - public $oldcopy; - /** * @var int * @deprecated Use $status diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index e5232ca2e4ba3..f885c05951d46 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -125,11 +125,6 @@ class UserGroup extends CommonObject */ public $all_permissions_are_loaded; - /** - * @var static - */ - public $oldcopy; // To contains a clone of this when we need to save old properties of object - public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id'), 'entity' => array('type' => 'integer', 'label' => 'Entity', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'default' => '1', 'index' => 1, 'position' => 5),