From 76309601c610eb2d756e518595111d7c927d1a6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Sun, 8 Dec 2024 09:17:27 +0100 Subject: [PATCH 1/2] fix phpstan --- build/phpstan/phpstan-baseline.neon | 30 --------------------------- htdocs/public/members/new.php | 6 +++--- htdocs/public/members/public_card.php | 6 +++--- htdocs/public/members/public_list.php | 11 +++++++--- htdocs/public/notice.php | 6 +++++- 5 files changed, 19 insertions(+), 40 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 16a99021701..6a3654e3dae 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -28812,36 +28812,6 @@ parameters: count: 1 path: ../../htdocs/public/members/public_list.php - - - message: '#^Variable \$conf might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../htdocs/public/members/public_list.php - - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 12 - path: ../../htdocs/public/members/public_list.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 6 - path: ../../htdocs/public/members/public_list.php - - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/public/notice.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/public/notice.php - - message: '#^Call to function is_numeric\(\) with int will always evaluate to true\.$#' identifier: function.alreadyNarrowedType diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 3389a688bda..df26dbf783a 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -55,9 +55,9 @@ if (!defined('NOBROWSERNOTIF')) { // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php // Because 2 entities can have the same ref. $entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); -if (is_numeric($entity)) { - define("DOLENTITY", $entity); -} +// if (is_numeric($entity)) { // $entity is casted to int +define("DOLENTITY", $entity); +// } // Load Dolibarr environment diff --git a/htdocs/public/members/public_card.php b/htdocs/public/members/public_card.php index a00be39a2d5..ed2a67f24ee 100644 --- a/htdocs/public/members/public_card.php +++ b/htdocs/public/members/public_card.php @@ -43,9 +43,9 @@ if (!defined('NOBROWSERNOTIF')) { // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php // Because 2 entities can have the same ref. $entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); -if (is_numeric($entity)) { - define("DOLENTITY", $entity); -} +// if (is_numeric($entity)) { // $entity is casted to int +define("DOLENTITY", $entity); +// } // Load Dolibarr environment require '../../main.inc.php'; diff --git a/htdocs/public/members/public_list.php b/htdocs/public/members/public_list.php index 97061659a70..5445587309c 100644 --- a/htdocs/public/members/public_list.php +++ b/htdocs/public/members/public_list.php @@ -42,12 +42,17 @@ if (!defined('NOBROWSERNOTIF')) { // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php // Because 2 entities can have the same ref. $entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); -if (is_numeric($entity)) { - define("DOLENTITY", $entity); -} +// if (is_numeric($entity)) { // $entity is casted to int +define("DOLENTITY", $entity); +// } // Load Dolibarr environment require '../../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var Translate $langs + */ // Security check if (!isModEnabled('member')) { diff --git a/htdocs/public/notice.php b/htdocs/public/notice.php index ab37aa7d420..ac1af27f150 100644 --- a/htdocs/public/notice.php +++ b/htdocs/public/notice.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 Frédéric France * * 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 @@ -41,7 +42,10 @@ if (!defined('NOBROWSERNOTIF')) { // Load Dolibarr environment require '../main.inc.php'; - +/** + * @var DoliDB $db + * @var Translate $langs + */ /** * View From 3ebc8d9d7a79f139555c252ce67e961bef8cb6cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Sun, 8 Dec 2024 09:49:10 +0100 Subject: [PATCH 2/2] wip --- htdocs/core/tpl/extrafields_add.tpl.php | 4 ++-- htdocs/core/tpl/extrafields_edit.tpl.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/tpl/extrafields_add.tpl.php b/htdocs/core/tpl/extrafields_add.tpl.php index a4000c2fa4d..78cd0eaec94 100644 --- a/htdocs/core/tpl/extrafields_add.tpl.php +++ b/htdocs/core/tpl/extrafields_add.tpl.php @@ -1,6 +1,6 @@ - * Copyright (C) 2014 Juanjo Menent +/* Copyright (C) 2014 Maxime Kohlhaas + * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify diff --git a/htdocs/core/tpl/extrafields_edit.tpl.php b/htdocs/core/tpl/extrafields_edit.tpl.php index 2a623a3ba84..7d72a0cae3b 100644 --- a/htdocs/core/tpl/extrafields_edit.tpl.php +++ b/htdocs/core/tpl/extrafields_edit.tpl.php @@ -1,6 +1,6 @@ - * Copyright (C) 2014 Juanjo Menent +/* Copyright (C) 2014 Maxime Kohlhaas + * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify