From 4492cedc5435f8d7ea62263113c164400dfd338d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Sat, 16 Nov 2024 01:15:25 +0100 Subject: [PATCH] fix --- build/phpstan/phpstan-baseline.neon | 60 ++++++++++++----------------- htdocs/core/ajax/ajaxextrafield.php | 8 +++- 2 files changed, 31 insertions(+), 37 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index bbacb30775f..b6f764ecdd5 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -9558,6 +9558,30 @@ parameters: count: 5 path: ../../htdocs/core/ajax/ajaxdirtree.php + - + message: '#^Call to function is_array\(\) with list\ will always evaluate to true\.$#' + identifier: function.alreadyNarrowedType + count: 3 + path: ../../htdocs/core/ajax/ajaxextrafield.php + + - + message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#' + identifier: function.alreadyNarrowedType + count: 2 + path: ../../htdocs/core/ajax/ajaxextrafield.php + + - + message: '#^Variable \$mode might not be defined\.$#' + identifier: variable.undefined + count: 1 + path: ../../htdocs/core/ajax/ajaxextrafield.php + + - + message: '#^Variable \$value might not be defined\.$#' + identifier: variable.undefined + count: 1 + path: ../../htdocs/core/ajax/ajaxextrafield.php + - message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -31884,30 +31908,6 @@ parameters: count: 1 path: ../../htdocs/public/test/test_arrays.php - - - message: '#^Variable \$conf might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../htdocs/public/test/test_badges.php - - - - message: '#^Variable \$dolibarr_main_prod might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/public/test/test_badges.php - - - - message: '#^Parameter \#7 \$params of function dolGetButtonAction expects array\{confirm\?\: array\{url\?\: string, title\?\: string, content\?\: string, action\-btn\-label\?\: string, cancel\-btn\-label\?\: string, modal\?\: bool\}, attr\?\: array\, areDropdownButtons\?\: bool, backtopage\?\: string, lang\?\: string, enabled\?\: bool, perm\?\: int\<0, 1\>, label\?\: string, \.\.\.\}, array\{confirm\: true\} given\.$#' - identifier: argument.type - count: 2 - path: ../../htdocs/public/test/test_buttons.php - - - - message: '#^Variable \$dolibarr_main_prod might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/public/test/test_buttons.php - - message: '#^Variable \$dolibarr_main_prod might not be defined\.$#' identifier: variable.undefined @@ -31920,18 +31920,6 @@ parameters: count: 1 path: ../../htdocs/public/test/test_exec.php - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/public/test/test_forms.php - - - - message: '#^Variable \$dolibarr_main_prod might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/public/test/test_forms.php - - message: '#^Variable \$dolibarr_main_prod might not be defined\.$#' identifier: variable.undefined diff --git a/htdocs/core/ajax/ajaxextrafield.php b/htdocs/core/ajax/ajaxextrafield.php index de0ea3d79a6..1416bbb105a 100644 --- a/htdocs/core/ajax/ajaxextrafield.php +++ b/htdocs/core/ajax/ajaxextrafield.php @@ -41,7 +41,12 @@ if (!defined('NOHEADERNOFOOTER')) { include '../../main.inc.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php'; -/** @var DoliDB $db */ +/** + * @var Conf $conf + * @var DoliDB $db + * @var Translate $langs + * @var User $user + */ // object id $id = GETPOST('id', 'aZ09'); @@ -97,6 +102,7 @@ if ($page == 1) { 'text' => ' ', ]; } +$i = 0; if (is_object($object)) { $extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label($element);