From cfb831ea4f0842aba3a0a30a9fb97e8d9f07f986 Mon Sep 17 00:00:00 2001 From: f2cmb <2480194+f2cmb@users.noreply.github.com> Date: Thu, 20 Nov 2025 15:14:07 +0100 Subject: [PATCH 1/5] fix returns on PHPDoc only --- src/ChangeTask.php | 4 ++-- src/Change_Problem.php | 2 ++ src/Change_Ticket.php | 2 ++ src/CommonITILRecurrent.php | 1 + src/ProblemTask.php | 4 ++-- src/Problem_Ticket.php | 2 ++ src/TicketTask.php | 4 ++-- 7 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/ChangeTask.php b/src/ChangeTask.php index 78a875adf26..d52ade6e5b4 100644 --- a/src/ChangeTask.php +++ b/src/ChangeTask.php @@ -44,7 +44,7 @@ public static function getTypeName($nb = 0) /** * Populate the planning with planned ticket tasks * - * @param $options array of possible options: + * @param array $options array of possible options: * - who ID of the user (0 = undefined) * - whogroup ID of the group of users (0 = undefined) * - begin Date @@ -76,7 +76,7 @@ public static function displayPlanningItem(array $val, $who, $type = "", $comple /** * Populate the planning with not planned ticket tasks * - * @param $options array of possible options: + * @param array $options array of possible options: * - who ID of the user (0 = undefined) * - whogroup ID of the group of users (0 = undefined) * - begin Date diff --git a/src/Change_Problem.php b/src/Change_Problem.php index af01758ef7b..bda10bc0d46 100644 --- a/src/Change_Problem.php +++ b/src/Change_Problem.php @@ -102,6 +102,7 @@ public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $ * Show tickets for a problem * * @param Problem $problem + * @return void|false **/ public static function showForProblem(Problem $problem) { @@ -194,6 +195,7 @@ public static function showForProblem(Problem $problem) * Show problems for a change * * @param Change $change object + * @return void|false **/ public static function showForChange(Change $change) { diff --git a/src/Change_Ticket.php b/src/Change_Ticket.php index 2920ed246c8..cb768fe5284 100644 --- a/src/Change_Ticket.php +++ b/src/Change_Ticket.php @@ -206,6 +206,7 @@ public static function processMassiveActionsForOneItemtype( * Show tickets for a change * * @param Change $change + * @return void|false **/ public static function showForChange(Change $change) { @@ -307,6 +308,7 @@ public static function showForChange(Change $change) * Show changes for a ticket * * @param Ticket $ticket object + * @return void|false **/ public static function showForTicket(Ticket $ticket) { diff --git a/src/CommonITILRecurrent.php b/src/CommonITILRecurrent.php index e321b7c244b..a6221073f51 100644 --- a/src/CommonITILRecurrent.php +++ b/src/CommonITILRecurrent.php @@ -44,6 +44,7 @@ */ abstract class CommonITILRecurrent extends CommonDropdown { + /** @use Clonable */ use Clonable; /** diff --git a/src/ProblemTask.php b/src/ProblemTask.php index 6735fbaba25..6235067511a 100644 --- a/src/ProblemTask.php +++ b/src/ProblemTask.php @@ -43,7 +43,7 @@ public static function getTypeName($nb = 0) /** * Populate the planning with planned problem tasks * - * @param $options array of possible options: + * @param array $options array of possible options: * - who ID of the user (0 = undefined) * - whogroup ID of the group of users (0 = undefined) * - begin Date @@ -75,7 +75,7 @@ public static function displayPlanningItem(array $val, $who, $type = "", $comple /** * Populate the planning with not planned problem tasks * - * @param $options array of possible options: + * @param array $options array of possible options: * - who ID of the user (0 = undefined) * - whogroup ID of the group of users (0 = undefined) * - begin Date diff --git a/src/Problem_Ticket.php b/src/Problem_Ticket.php index d666b61d3c2..a9c0c3dd472 100644 --- a/src/Problem_Ticket.php +++ b/src/Problem_Ticket.php @@ -191,6 +191,7 @@ public static function processMassiveActionsForOneItemtype( * Show tickets for a problem * * @param Problem $problem + * @return void|false **/ public static function showForProblem(Problem $problem) { @@ -266,6 +267,7 @@ public static function showForProblem(Problem $problem) * Show problems for a ticket * * @param Ticket $ticket object + * @return void|false **/ public static function showForTicket(Ticket $ticket) { diff --git a/src/TicketTask.php b/src/TicketTask.php index 353df8c787a..6691d62fbc7 100644 --- a/src/TicketTask.php +++ b/src/TicketTask.php @@ -43,7 +43,7 @@ public static function getTypeName($nb = 0) /** * Populate the planning with planned ticket tasks * - * @param $options array of possible options: + * @param array $options array of possible options: * - who ID of the user (0 = undefined) * - whogroup ID of the group of users (0 = undefined) * - begin Date @@ -60,7 +60,7 @@ public static function populatePlanning($options = []): array /** * Populate the planning with planned ticket tasks * - * @param $options array of possible options: + * @param array $options array of possible options: * - who ID of the user (0 = undefined) * - whogroup ID of the group of users (0 = undefined) * - begin Date From 5eb5d75a503ffd16de4c46cc4c10302205d6a4cc Mon Sep 17 00:00:00 2001 From: f2cmb <2480194+f2cmb@users.noreply.github.com> Date: Fri, 21 Nov 2025 08:58:41 +0100 Subject: [PATCH 2/5] add return statements to SHowFor* methods / fix use on COmmonITILRecurrent --- src/Change_Problem.php | 8 ++++++-- src/CommonITILRecurrent.php | 2 +- src/Problem_Ticket.php | 8 ++++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/Change_Problem.php b/src/Change_Problem.php index bda10bc0d46..4a07100dfef 100644 --- a/src/Change_Problem.php +++ b/src/Change_Problem.php @@ -102,7 +102,7 @@ public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $ * Show tickets for a problem * * @param Problem $problem - * @return void|false + * @return false **/ public static function showForProblem(Problem $problem) { @@ -189,13 +189,15 @@ public static function showForProblem(Problem $problem) 'container' => 'mass' . static::class . $rand, ], ]); + + return false; } /** * Show problems for a change * * @param Change $change object - * @return void|false + * @return false **/ public static function showForChange(Change $change) { @@ -281,5 +283,7 @@ public static function showForChange(Change $change) 'container' => 'mass' . static::class . $rand, ], ]); + + return false; } } diff --git a/src/CommonITILRecurrent.php b/src/CommonITILRecurrent.php index a6221073f51..a652c1d61a3 100644 --- a/src/CommonITILRecurrent.php +++ b/src/CommonITILRecurrent.php @@ -44,7 +44,7 @@ */ abstract class CommonITILRecurrent extends CommonDropdown { - /** @use Clonable */ + /** @use Clonable */ use Clonable; /** diff --git a/src/Problem_Ticket.php b/src/Problem_Ticket.php index a9c0c3dd472..12ab068e2c7 100644 --- a/src/Problem_Ticket.php +++ b/src/Problem_Ticket.php @@ -191,7 +191,7 @@ public static function processMassiveActionsForOneItemtype( * Show tickets for a problem * * @param Problem $problem - * @return void|false + * @return false **/ public static function showForProblem(Problem $problem) { @@ -261,13 +261,15 @@ public static function showForProblem(Problem $problem) 'extraparams' => ['problems_id' => $problem->getID()], ], ]); + + return false; } /** * Show problems for a ticket * * @param Ticket $ticket object - * @return void|false + * @return false **/ public static function showForTicket(Ticket $ticket) { @@ -333,6 +335,8 @@ public static function showForTicket(Ticket $ticket) 'container' => 'mass' . static::class . $rand, ], ]); + + return false; } /** From e5d1c1dc28770a9a35b00b80a2be9665b4d76574 Mon Sep 17 00:00:00 2001 From: f2cmb <2480194+f2cmb@users.noreply.github.com> Date: Mon, 24 Nov 2025 09:25:17 +0100 Subject: [PATCH 3/5] remove unecessaries return on ShoWFor* methods --- src/Change_Problem.php | 10 ++++------ src/Problem_Ticket.php | 10 ++++------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/Change_Problem.php b/src/Change_Problem.php index 4a07100dfef..f3e5810a3fd 100644 --- a/src/Change_Problem.php +++ b/src/Change_Problem.php @@ -102,7 +102,7 @@ public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $ * Show tickets for a problem * * @param Problem $problem - * @return false + * @return void **/ public static function showForProblem(Problem $problem) { @@ -110,7 +110,7 @@ public static function showForProblem(Problem $problem) $ID = $problem->getField('id'); if (!$problem->can($ID, READ)) { - return false; + return; } $canedit = $problem->canEdit($ID); @@ -190,14 +190,13 @@ public static function showForProblem(Problem $problem) ], ]); - return false; } /** * Show problems for a change * * @param Change $change object - * @return false + * @return void **/ public static function showForChange(Change $change) { @@ -205,7 +204,7 @@ public static function showForChange(Change $change) $ID = $change->getField('id'); if (!$change->can($ID, READ)) { - return false; + return; } $canedit = $change->canEdit($ID); @@ -284,6 +283,5 @@ public static function showForChange(Change $change) ], ]); - return false; } } diff --git a/src/Problem_Ticket.php b/src/Problem_Ticket.php index 12ab068e2c7..ec6f1b03deb 100644 --- a/src/Problem_Ticket.php +++ b/src/Problem_Ticket.php @@ -191,14 +191,14 @@ public static function processMassiveActionsForOneItemtype( * Show tickets for a problem * * @param Problem $problem - * @return false + * @return void **/ public static function showForProblem(Problem $problem) { $ID = $problem->getField('id'); if (!static::canView() || !$problem->can($ID, READ)) { - return false; + return; } $canedit = $problem->canEdit($ID); @@ -262,14 +262,13 @@ public static function showForProblem(Problem $problem) ], ]); - return false; } /** * Show problems for a ticket * * @param Ticket $ticket object - * @return false + * @return void **/ public static function showForTicket(Ticket $ticket) { @@ -277,7 +276,7 @@ public static function showForTicket(Ticket $ticket) $ID = $ticket->getField('id'); if (!static::canView() || !$ticket->can($ID, READ)) { - return false; + return; } $canedit = $ticket->can($ID, UPDATE); @@ -336,7 +335,6 @@ public static function showForTicket(Ticket $ticket) ], ]); - return false; } /** From 89809e98ad5690f46922efc2e0dd16b9bb29fc70 Mon Sep 17 00:00:00 2001 From: f2cmb <2480194+f2cmb@users.noreply.github.com> Date: Mon, 24 Nov 2025 09:38:47 +0100 Subject: [PATCH 4/5] fix void return on showFor* methods --- src/Change_Ticket.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Change_Ticket.php b/src/Change_Ticket.php index cb768fe5284..56031d12f55 100644 --- a/src/Change_Ticket.php +++ b/src/Change_Ticket.php @@ -206,7 +206,7 @@ public static function processMassiveActionsForOneItemtype( * Show tickets for a change * * @param Change $change - * @return void|false + * @return void **/ public static function showForChange(Change $change) { @@ -214,7 +214,7 @@ public static function showForChange(Change $change) $ID = $change->getField('id'); if (!$change->can($ID, READ)) { - return false; + return; } $canedit = $change->canEdit($ID); @@ -308,7 +308,7 @@ public static function showForChange(Change $change) * Show changes for a ticket * * @param Ticket $ticket object - * @return void|false + * @return void **/ public static function showForTicket(Ticket $ticket) { @@ -316,7 +316,7 @@ public static function showForTicket(Ticket $ticket) $ID = $ticket->getField('id'); if (!$ticket->can($ID, READ)) { - return false; + return; } $canedit = $ticket->canEdit($ID); From ba90c559d6c7b8a833b9ab6aa8046532e4a3509b Mon Sep 17 00:00:00 2001 From: Johan Cwiklinski Date: Mon, 24 Nov 2025 09:48:59 +0100 Subject: [PATCH 5/5] Apply suggestions from code review --- src/Change_Problem.php | 2 -- src/Problem_Ticket.php | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/Change_Problem.php b/src/Change_Problem.php index f3e5810a3fd..5afb95bc5b7 100644 --- a/src/Change_Problem.php +++ b/src/Change_Problem.php @@ -189,7 +189,6 @@ public static function showForProblem(Problem $problem) 'container' => 'mass' . static::class . $rand, ], ]); - } /** @@ -282,6 +281,5 @@ public static function showForChange(Change $change) 'container' => 'mass' . static::class . $rand, ], ]); - } } diff --git a/src/Problem_Ticket.php b/src/Problem_Ticket.php index ec6f1b03deb..7742c37b34b 100644 --- a/src/Problem_Ticket.php +++ b/src/Problem_Ticket.php @@ -261,7 +261,6 @@ public static function showForProblem(Problem $problem) 'extraparams' => ['problems_id' => $problem->getID()], ], ]); - } /** @@ -334,7 +333,6 @@ public static function showForTicket(Ticket $ticket) 'container' => 'mass' . static::class . $rand, ], ]); - } /**