Qual: Fix PHPStan warning (undefined variable $maxlength) in recruitmentcandidature_list.php (#38772)

PHPStan level 9 (apstats config) reports at line 444:
"Variable $maxlength might not be defined."

$maxlength was never defined in this file and was passed as the 4th
argument (max label length) of FormProjets::select_projects(). An
undefined variable evaluates to null, and dol_trunc() returns the string
unchanged when its size argument is empty (null or 0). Passing 0
explicitly keeps the exact same behaviour (no truncation) and removes
the undefined-variable warning.

Co-authored-by: Muvikx <kilyan.cotten@epitech.eu>
This commit is contained in:
evarisk-kilyan 2026-06-14 01:09:00 +02:00 committed by GitHub
parent 7dd658bab6
commit cabdee496b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -441,7 +441,7 @@ if ($jobposition->id > 0 && (empty($action) || ($action != 'edit' && $action !=
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref .= $formproject->select_projects(0, (string) $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= $formproject->select_projects(0, (string) $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
} else {