fix phpstan (#31543)

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan
This commit is contained in:
Frédéric FRANCE 2024-10-25 14:15:39 +02:00 committed by GitHub
parent 25fe870fb8
commit 801a759975
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 80 additions and 22 deletions

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2014-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2015-2024 Frédéric France <frederic.france@free.fr>
*
* 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

View File

@ -53,9 +53,15 @@ if (GETPOSTISSET('infologin')) {
if (GETPOSTISSET('option')) {
$params['option'] = GETPOST('option', 'restricthtml');
}
$element_ref = '';
if (is_numeric($id)) {
$id = (int) $id;
} else {
$element_ref = $id;
$id = 0;
}
// Load object according to $element
$object = fetchObjectByElement($id, $objecttype);
$object = fetchObjectByElement($id, $objecttype, $element_ref);
if (empty($object->element)) {
httponly_accessforbidden('Failed to get object with fetchObjectByElement(id='.$id.', objecttype='.$objecttype.')');
}

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2022 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2022 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -51,7 +52,14 @@ $field = GETPOST('field', 'aZ09');
$value = GETPOST('value', 'aZ09');
$module = getElementProperties($objectType)['module'];
$object = fetchObjectByElement($objectId, $objectType);
$element_ref = '';
if (is_numeric($objectId)) {
$objectId = (int) $objectId;
} else {
$element_ref = $objectId;
$objectId = 0;
}
$object = fetchObjectByElement($objectId, $objectType, $element_ref);
// Security check
if (!$user->hasRight($module, $object->element, 'write') && !$user->hasRight($module, 'write')) {

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2011-2014 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
/* Copyright (C) 2011-2014 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -42,10 +43,16 @@ $field = GETPOST('field', 'alpha');
$element = GETPOST('element', 'alpha');
$table_element = GETPOST('table_element', 'alpha');
$fk_element = GETPOST('fk_element', 'alpha');
$id = $fk_element;
// Load object according to $id and $element
$object = fetchObjectByElement($id, $element);
$element_ref = '';
if (is_numeric($fk_element)) {
$id = (int) $fk_element;
} else {
$element_ref = $fk_element;
$id = 0;
}
$object = fetchObjectByElement($id, $element, $element_ref);
$module = $object->module;
$element = $object->element;

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2011-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
/* Copyright (C) 2011-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -57,7 +58,14 @@ savemethodname:
*/
// Load object according to $id and $element
$object = fetchObjectByElement($id, $element);
$element_ref = '';
if (is_numeric($fk_element)) {
$id = (int) $fk_element;
} else {
$element_ref = $fk_element;
$id = 0;
}
$object = fetchObjectByElement($id, $element, $element_ref);
$module = $object->module;
$element = $object->element;

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2014 Charles-Fr BENKE <charles.fr@benke.fr>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2015-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify

View File

@ -3,8 +3,8 @@
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2014 Charles-Fr BENKE <charles.fr@benke.fr>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2015-2024 Frédéric France <frederic.france@free.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

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2012 Charles-François BENKE <charles.fr@benke.fr>
* Copyright (C) 2005-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014-2021 Frederic France <frederic.france@netlogic.fr>
* Copyright (C) 2014-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015-2023 Frederic France <frederic.france@netlogic.fr>
* Copyright (C) 2015-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2015-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2015-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify

View File

@ -126,20 +126,49 @@ class Opensurveysondage extends CommonObject
* @var string Id sondage not an int
*/
public $id_sondage;
/**
* @var string Description
* @deprecated Use $description instead
*/
public $commentaires;
/**
* @var string admin mail
*/
public $mail_admin;
/**
* @var string admin name
*/
public $nom_admin;
/**
* @var int ID of user
*/
public $fk_user_creat;
/**
* @var string title of survey
*/
public $title;
/**
* @var int|'' end date of survey
*/
public $date_fin = '';
public $status;
/**
* @var string format 'A' = Text choice (choices are saved into sujet field), 'D' = Date choice (choices are saved into sujet field), 'F' = Form survey
*/
public $format;
/**
* @var int to allow send mail
*/
public $mailsonde;
public $entity;
/**
* @var int Allow comments on this poll
*/
@ -274,7 +303,7 @@ class Opensurveysondage extends CommonObject
/**
* Load object in memory from the database
*
* @param int $id Id object
* @param string $id Id object
* @param string $numsurvey Ref of survey (admin or not)
* @return int Return integer <0 if KO, >0 if OK
*/

View File

@ -84,7 +84,7 @@ parameters:
- '# EmailCollector::getpart\(\) expects string#'
- '#(?:(?:CommonStickerGenerator::_Croix|pdf_(?:azur::_tableau_(?:info|tot)|ban::_tableau))\(\)|pdf_(?:bank|c(?:anelle::_tableau_(?:(?:tot|versements)\(\))|ornas::_tableau_(?:(?:info|tot)\(\))|rabe::_tableau_(?:(?:info|tot|versements)\(\))|yan::draw(?:(?:Info|Total)Table\(\)))|e(?:agle(?:(?:::_tableau_tot|_proforma::drawTotalTable)\(\))|instein::_tableau_(?:(?:info|tot)\(\))|ratosthene::draw(?:(?:Info|Total)Table\(\))|spadon::_tableau_tot\(\))|muscadet::_tableau_(?:(?:info|tot)\(\))|octopus::(?:_table(?:(?:FirstPage|au)\(\))|draw(?:(?:Info|Total)Table\(\)))|page(?:foot|head)|(?:rouget::_tableau_tot|s(?:epamandate::_tableau(?:_info)?|ponge::draw(?:(?:Info|Total)Table)|quille::_tableau_tot|t(?:andard_(?:e(?:(?:valuation|xpensereport)::_tableau|xpensereport::tablePayments)|(?:myobjec|supplierpaymen)t::_tableau|supplierpayment::_tableau_cheque)|orm::_tableau_info|rato::tabSignature))|t(?:cpdflabel::writeBarcode|yphon::_tableau_info)|vinci::_tableau_info)\(\)|w(?:atermark|rite(?:LinkedObjects|linedesc))|zenith::_tableau_tot\(\))) expects int, float given\.#'
- '#(?:Comm(?:(?:ande::updateline|on(?:Invoice::getLibStatut|StickerGenerator::Set_Char_Size))\(\))|Facture(?:(?:::update|FournisseurRec::add)line\(\))|(?:Holiday::addLogCP|Loan::getLibStatut|SupplierProposal::updateline)\(\)|calcul_price_total) expects int, float given\.#'
- '#(?:dol_(?:mktime|remove_file_process)|fetchObjectByElement|print_actions_filter) expects int, array\|string given\.#'
- '#(?:dol_(?:mktime|remove_file_process)|print_actions_filter) expects int, array\|string given\.#'
- '# (CSMSFile) constructor expects int, array\|string given.#'
- '#(?:ProductFournisseur::logPrice\(\)) expects float\|null#'
- '#(?:(?:Asset::addDepreciationL|Facture(?:(?:(?:Fournisseur)?::add|Fournisseur::update)l))ine\(\)|calcul_price_total|dol_convertToWord|(?:loanCalcMonthlyPaymen|print_paypal_redirec)t) expects float, string given.#'