Qual: Fix PhanTypeComparisonFromArray in pertype.php and peruser.php (#36068)
# Qual: Fix PhanTypeComparisonFromArray in pertype.php and peruser.php - Update pertype.php and peruser.php to resolve PhanTypeComparisonFromArray notices. When an array value is set, it's already an array so comparing to '' is useless and invalid. - Update baseline.txt to reflect reduced occurrences of phan issues. Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
parent
71b4612a47
commit
c4712cbca7
3 changed files with 33 additions and 13 deletions
|
|
@ -16,15 +16,14 @@ return [
|
|||
// PhanTypeMismatchArgumentNullable : 20+ occurrences
|
||||
// PhanTypeInvalidDimOffset : 15+ occurrences
|
||||
// PhanTypeMismatchDimFetch : 10+ occurrences
|
||||
// PhanUndeclaredMethod : 8 occurrences
|
||||
// PhanUndeclaredMethod : 7 occurrences
|
||||
// PhanPossiblyUndeclaredGlobalVariable : 6 occurrences
|
||||
// PhanTypeComparisonFromArray : 6 occurrences
|
||||
// PhanTypeArraySuspiciousNull : 5 occurrences
|
||||
// PhanTypeExpectedObjectPropAccess : 5 occurrences
|
||||
// PhanPluginDuplicateArrayKey : 4 occurrences
|
||||
// PhanParamTooMany : 3 occurrences
|
||||
// PhanPluginUndeclaredVariableIsset : 2 occurrences
|
||||
// PhanTypeMismatchArgumentProbablyReal : 2 occurrences
|
||||
// PhanParamTooMany : 1 occurrence
|
||||
// PhanPossiblyUndeclaredVariable : 1 occurrence
|
||||
// PhanTypeExpectedObjectPropAccessButGotNull : 1 occurrence
|
||||
// PhanTypeMismatchReturn : 1 occurrence
|
||||
|
|
@ -34,8 +33,8 @@ return [
|
|||
'htdocs/bookcal/class/calendar.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'],
|
||||
'htdocs/categories/viewcat.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/comm/action/index.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchProperty'],
|
||||
'htdocs/comm/action/pertype.php' => ['PhanTypeComparisonFromArray', 'PhanTypeExpectedObjectPropAccess'],
|
||||
'htdocs/comm/action/peruser.php' => ['PhanTypeComparisonFromArray', 'PhanTypeMismatchArgument'],
|
||||
'htdocs/comm/action/pertype.php' => ['PhanTypeExpectedObjectPropAccess'],
|
||||
'htdocs/comm/action/peruser.php' => ['PhanTypeMismatchArgument'],
|
||||
'htdocs/comm/card.php' => ['PhanTypeMismatchArgument'],
|
||||
'htdocs/comm/mailing/index.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/comm/mailing/targetemailing.php' => ['PhanUndeclaredProperty'],
|
||||
|
|
|
|||
|
|
@ -311,7 +311,7 @@ if ($usergroup > 0) {
|
|||
if ($socid > 0) {
|
||||
$param .= "&search_socid=".urlencode((string) ($socid));
|
||||
}
|
||||
if ($showbirthday) { // Always false @phpstan-suppress-current-line
|
||||
if ($showbirthday) { // Always false @phpstan-ignore-line
|
||||
$param .= "&search_showbirthday=1";
|
||||
}
|
||||
if ($pid) {
|
||||
|
|
@ -1016,6 +1016,14 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s
|
|||
|
||||
$cases1 = array(); // Color first half hour
|
||||
$cases2 = array(); // Color second half hour
|
||||
/**
|
||||
* @var array<int,array<int,array<string,string|int|bool>>> $cases1
|
||||
* @var array<int,array<int,array<string,string|int|bool>>> $cases2
|
||||
*/
|
||||
'
|
||||
@phan-var-force array<int,array<int,array<string,string|int|bool>>> $cases1
|
||||
@phan-var-force array<int,array<int,array<string,string|int|bool>>> $cases2
|
||||
';
|
||||
|
||||
$i = 0;
|
||||
$nummytasks = 0;
|
||||
|
|
@ -1236,7 +1244,7 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s
|
|||
$string2 = ' ';
|
||||
$title1 = '';
|
||||
$title2 = '';
|
||||
if (isset($cases1[$h]) && $cases1[$h] != '') {
|
||||
if (isset($cases1[$h])) {
|
||||
//$title1.=count($cases1[$h]).' '.(count($cases1[$h])==1?$langs->trans("Event"):$langs->trans("Events"));
|
||||
if (count($cases1[$h]) > 1) {
|
||||
$title1 .= count($cases1[$h]).' '.(count($cases1[$h]) == 1 ? $langs->trans("Event") : $langs->trans("Events"));
|
||||
|
|
@ -1253,7 +1261,7 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s
|
|||
}
|
||||
}
|
||||
}
|
||||
if (isset($cases2[$h]) && $cases2[$h] != '') {
|
||||
if (isset($cases2[$h])) {
|
||||
//$title2.=count($cases2[$h]).' '.(count($cases2[$h])==1?$langs->trans("Event"):$langs->trans("Events"));
|
||||
if (count($cases2[$h]) > 1) {
|
||||
$title2 .= count($cases2[$h]).' '.(count($cases2[$h]) == 1 ? $langs->trans("Event") : $langs->trans("Events"));
|
||||
|
|
|
|||
|
|
@ -363,7 +363,7 @@ if ($usergroup > 0) {
|
|||
if ($socid > 0) {
|
||||
$param .= "&search_socid=".urlencode((string) ($socid));
|
||||
}
|
||||
if ($showbirthday) { // Always false @phpstan-suppress-current-line
|
||||
if ($showbirthday) { // Always false @phpstan-ignore-line
|
||||
$param .= "&search_showbirthday=1";
|
||||
}
|
||||
if ($pid) {
|
||||
|
|
@ -1901,6 +1901,19 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
|||
$cases3 = array(); // Color third half hour
|
||||
$cases4 = array(); // Color 4th half hour
|
||||
|
||||
/**
|
||||
* @var array<int,array<int,array<string,string|int|bool>>> $cases1
|
||||
* @var array<int,array<int,array<string,string|int|bool>>> $cases2
|
||||
* @var array<int,array<int,array<string,string|int|bool>>> $cases3
|
||||
* @var array<int,array<int,array<string,string|int|bool>>> $cases4
|
||||
*/
|
||||
'
|
||||
@phan-var-force array<int,array<int,array<string,string|int|bool>>> $cases1
|
||||
@phan-var-force array<int,array<int,array<string,string|int|bool>>> $cases2
|
||||
@phan-var-force array<int,array<int,array<string,string|int|bool>>> $cases3
|
||||
@phan-var-force array<int,array<int,array<string,string|int|bool>>> $cases4
|
||||
';
|
||||
|
||||
$i = 0;
|
||||
$numother = 0;
|
||||
$numbirthday = 0;
|
||||
|
|
@ -2296,7 +2309,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
|||
$title2 = '';
|
||||
$title3 = '';
|
||||
$title4 = '';
|
||||
if (isset($cases1[$h]) && $cases1[$h] != '') {
|
||||
if (isset($cases1[$h])) {
|
||||
//$title1.=count($cases1[$h]).' '.(count($cases1[$h])==1?$langs->trans("Event"):$langs->trans("Events"));
|
||||
if (count($cases1[$h]) > 1) {
|
||||
$title1 .= count($cases1[$h]).' '.(count($cases1[$h]) == 1 ? $langs->trans("Event") : $langs->trans("Events"));
|
||||
|
|
@ -2316,7 +2329,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
|||
}
|
||||
}
|
||||
}
|
||||
if (isset($cases2[$h]) && $cases2[$h] != '') {
|
||||
if (isset($cases2[$h])) {
|
||||
//$title2.=count($cases2[$h]).' '.(count($cases2[$h])==1?$langs->trans("Event"):$langs->trans("Events"));
|
||||
if (count($cases2[$h]) > 1) {
|
||||
$title2 .= count($cases2[$h]).' '.(count($cases2[$h]) == 1 ? $langs->trans("Event") : $langs->trans("Events"));
|
||||
|
|
@ -2336,7 +2349,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
|||
}
|
||||
}
|
||||
}
|
||||
if (isset($cases3[$h]) && $cases3[$h] != '') {
|
||||
if (isset($cases3[$h])) {
|
||||
//$title3.=count($cases3[$h]).' '.(count($cases3[$h])==1?$langs->trans("Event"):$langs->trans("Events"));
|
||||
if (count($cases3[$h]) > 1) {
|
||||
$title3 .= count($cases3[$h]).' '.(count($cases3[$h]) == 1 ? $langs->trans("Event") : $langs->trans("Events"));
|
||||
|
|
@ -2356,7 +2369,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
|||
}
|
||||
}
|
||||
}
|
||||
if (isset($cases4[$h]) && $cases4[$h] != '') {
|
||||
if (isset($cases4[$h])) {
|
||||
//$title4.=count($cases3[$h]).' '.(count($cases3[$h])==1?$langs->trans("Event"):$langs->trans("Events"));
|
||||
if (count($cases4[$h]) > 1) {
|
||||
$title4 .= count($cases4[$h]).' '.(count($cases4[$h]) == 1 ? $langs->trans("Event") : $langs->trans("Events"));
|
||||
|
|
|
|||
Loading…
Reference in a new issue