Merge pull request #32370 from frederic34/phpstan_2024_12_15

fix phpstan
This commit is contained in:
Laurent Destailleur 2024-12-17 02:57:34 +01:00 committed by GitHub
commit 8fcf8a4712
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 27 additions and 59 deletions

View file

@ -12252,12 +12252,6 @@ parameters:
count: 1
path: ../../htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php
-
message: '#^Variable \$outputlangsbis might not be defined\.$#'
identifier: variable.undefined
count: 7
path: ../../htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php
-
message: '#^Property mod_asset_standard\:\:\$prefix has no type specified\.$#'
identifier: missingType.property
@ -29658,12 +29652,6 @@ parameters:
count: 1
path: ../../htdocs/recruitment/class/recruitmentjobposition.class.php
-
message: '#^Negated boolean expression is always true\.$#'
identifier: booleanNot.alwaysTrue
count: 2
path: ../../htdocs/recruitment/class/recruitmentjobposition.class.php
-
message: '#^Property CommonObject\:\:\$ismultientitymanaged \(int\<0, 1\>\|string\) in isset\(\) is not nullable\.$#'
identifier: isset.property
@ -29676,12 +29664,6 @@ parameters:
count: 1
path: ../../htdocs/recruitment/class/recruitmentjobposition.class.php
-
message: '#^Variable \$error in empty\(\) always exists and is always falsy\.$#'
identifier: empty.variable
count: 1
path: ../../htdocs/recruitment/class/recruitmentjobposition.class.php
-
message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\<string, CommonObject\|float\|int\|string\>, RecruitmentJobPosition given\.$#'
identifier: argument.type
@ -29730,12 +29712,6 @@ parameters:
count: 1
path: ../../htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php
-
message: '#^Variable \$outputlangsbis might not be defined\.$#'
identifier: variable.undefined
count: 7
path: ../../htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php
-
message: '#^Variable \$badgeStatus0 might not be defined\.$#'
identifier: variable.undefined

View file

@ -1,22 +1,22 @@
<?php
/* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010-2020 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2011-2022 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2016 Bahfir abbes <bafbes@gmail.com>
* Copyright (C) 2017 ATM Consulting <support@atm-consulting.fr>
* Copyright (C) 2017-2019 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
/* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010-2020 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2011-2022 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2016 Bahfir abbes <bafbes@gmail.com>
* Copyright (C) 2017 ATM Consulting <support@atm-consulting.fr>
* Copyright (C) 2017-2019 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2018 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2023 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2021 Grégory Blémand <gregory.blemand@atm-consulting.fr>
* Copyright (C) 2023 Lenin Rivas <lenin.rivas777@gmail.com>
* Copyright (C) 2018 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2023 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2021 Grégory Blémand <gregory.blemand@atm-consulting.fr>
* Copyright (C) 2023 Lenin Rivas <lenin.rivas777@gmail.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 William Mead <william.mead@manchenumerique.fr>
*

View file

@ -173,8 +173,9 @@ class pdf_standard_asset extends ModelePDFAsset
// Load translation files required by the page
$outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies"));
global $outputlangsbis;
$outputlangsbis = null;
if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE') && $outputlangs->defaultlang != getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) {
global $outputlangsbis;
$outputlangsbis = new Translate('', $conf);
$outputlangsbis->setDefaultLang(getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE'));
$outputlangsbis->loadLangs(array("main", "bills", "products", "dict", "companies"));

View file

@ -552,20 +552,12 @@ class RecruitmentJobPosition extends CommonObject
return 0;
}
/*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->recruitmentjobposition->create))
|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->recruitmentjobposition->recruitmentjobposition_advance->validate))))
{
$this->error='NotEnoughPermissions';
dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR);
return -1;
}*/
$now = dol_now();
$this->db->begin();
// Define new ref
if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
if (/* !$error && */ (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
$num = $this->getNextNumRef();
} else {
$num = $this->ref;
@ -765,14 +757,12 @@ class RecruitmentJobPosition extends CommonObject
$this->generateDocument($modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
if (!$error) {
$this->oldcopy = clone $this;
$this->status = $status;
$this->date_cloture = $now;
$this->note_private = $newprivatenote;
}
$this->oldcopy = clone $this;
$this->status = $status;
$this->date_cloture = $now;
$this->note_private = $newprivatenote;
if (!$notrigger && empty($error)) {
if (!$notrigger /* && empty($error) */) {
// Call trigger
$result = $this->call_trigger($triggerName, $user);
if ($result < 0) {

View file

@ -210,8 +210,9 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio
// Load translation files required by the page
$outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies"));
global $outputlangsbis;
$outputlangsbis = null;
if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE') && $outputlangs->defaultlang != getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) {
global $outputlangsbis;
$outputlangsbis = new Translate('', $conf);
$outputlangsbis->setDefaultLang(getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE'));
$outputlangsbis->loadLangs(array("main", "bills", "products", "dict", "companies"));