Skip to content

Commit

Permalink
fix phpstan (Dolibarr#32188)
Browse files Browse the repository at this point in the history
* fix phpstan

* fix typos

* add phpdoc

* cut long line
  • Loading branch information
frederic34 authored Dec 1, 2024
1 parent e2f6c68 commit 01297ee
Show file tree
Hide file tree
Showing 21 changed files with 48 additions and 150 deletions.
132 changes: 0 additions & 132 deletions build/phpstan/phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -15378,54 +15378,18 @@ parameters:
count: 1
path: ../../htdocs/core/modules/oauth/generic_oauthcallback.php

-
message: '#^Variable \$dolibarr_main_url_root might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/core/modules/oauth/github_oauthcallback.php

-
message: '#^Variable \$state might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/core/modules/oauth/github_oauthcallback.php

-
message: '#^Variable \$dolibarr_main_url_root might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/core/modules/oauth/microsoft2_oauthcallback.php

-
message: '#^Variable \$dolibarr_main_url_root might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/core/modules/oauth/microsoft_oauthcallback.php

-
message: '#^Strict comparison using \=\=\= between null and null will always evaluate to true\.$#'
identifier: identical.alwaysTrue
count: 2
path: ../../htdocs/core/modules/oauth/stripelive_oauthcallback.php

-
message: '#^Variable \$dolibarr_main_url_root might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/core/modules/oauth/stripelive_oauthcallback.php

-
message: '#^Variable \$dolibarr_main_url_root might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/core/modules/oauth/stripetest_oauthcallback.php

-
message: '#^Variable \$dolibarr_main_url_root might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/core/modules/openid_connect/callback.php

-
message: '#^Property mod_payment_cicada\:\:\$prefix has no type specified\.$#'
identifier: missingType.property
Expand Down Expand Up @@ -18360,12 +18324,6 @@ parameters:
count: 1
path: ../../htdocs/ecm/file_card.php

-
message: '#^Variable \$dolibarr_main_url_root might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/ecm/file_card.php

-
message: '#^Variable \$module might not be defined\.$#'
identifier: variable.undefined
Expand Down Expand Up @@ -18654,12 +18612,6 @@ parameters:
count: 1
path: ../../htdocs/eventorganization/conferenceorbooth_contact.php

-
message: '#^Variable \$dolibarr_main_url_root might not be defined\.$#'
identifier: variable.undefined
count: 3
path: ../../htdocs/eventorganization/conferenceorbooth_contact.php

-
message: '#^Variable \$mode might not be defined\.$#'
identifier: variable.undefined
Expand Down Expand Up @@ -18690,12 +18642,6 @@ parameters:
count: 1
path: ../../htdocs/eventorganization/conferenceorbooth_document.php

-
message: '#^Variable \$dolibarr_main_url_root might not be defined\.$#'
identifier: variable.undefined
count: 3
path: ../../htdocs/eventorganization/conferenceorbooth_document.php

-
message: '#^Comparison operation "\>" between 0 and 0 is always false\.$#'
identifier: greater.alwaysFalse
Expand Down Expand Up @@ -24126,24 +24072,6 @@ parameters:
count: 1
path: ../../htdocs/master.inc.php

-
message: '#^Variable \$dolibarr_main_url_root might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../htdocs/master.inc.php

-
message: '#^Variable \$dolibarr_main_url_root_alt might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/master.inc.php

-
message: '#^Variable \$langs might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../htdocs/master.inc.php

-
message: '#^Call to function is_array\(\) with array\<int\|string, array\{modulenamewithcase\: mixed, moduledescriptorrelpath\: string, moduledescriptorfullpath\: mixed, moduledescriptorrootpath\: mixed, moduletype\?\: ''external''\|''internal''\}\> will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
Expand Down Expand Up @@ -25236,12 +25164,6 @@ parameters:
count: 1
path: ../../htdocs/opensurvey/card.php

-
message: '#^Variable \$dolibarr_main_url_root might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/opensurvey/card.php

-
message: '#^Variable \$id might not be defined\.$#'
identifier: variable.undefined
Expand Down Expand Up @@ -25332,66 +25254,18 @@ parameters:
count: 1
path: ../../htdocs/opensurvey/class/opensurveysondage.class.php

-
message: '#^Empty array passed to foreach\.$#'
identifier: foreach.emptyArray
count: 1
path: ../../htdocs/opensurvey/list.php

-
message: '#^Variable \$contextpage in empty\(\) always exists and is not falsy\.$#'
identifier: empty.variable
count: 1
path: ../../htdocs/opensurvey/list.php

-
message: '#^Variable \$nbuser might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/opensurvey/list.php

-
message: '#^Variable \$search_all might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/opensurvey/list.php

-
message: '#^Offset int\<0, max\> on array\<int\<0, max\>, int\<0, max\>\> in isset\(\) always exists and is not nullable\.$#'
identifier: isset.offset
count: 1
path: ../../htdocs/opensurvey/results.php

-
message: '#^Parameter \#4 \$month of function dol_mktime expects int, array\<mixed\>\|string given\.$#'
identifier: argument.type
count: 1
path: ../../htdocs/opensurvey/results.php

-
message: '#^Parameter \#5 \$day of function dol_mktime expects int, array\<mixed\>\|string given\.$#'
identifier: argument.type
count: 1
path: ../../htdocs/opensurvey/results.php

-
message: '#^Parameter \#6 \$year of function dol_mktime expects int, array\<mixed\>\|string given\.$#'
identifier: argument.type
count: 1
path: ../../htdocs/opensurvey/results.php

-
message: '#^Variable \$cleinsertion might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../htdocs/opensurvey/results.php

-
message: '#^Variable \$dolibarr_main_url_root might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/opensurvey/results.php

-
message: '#^Variable \$erreur_ajout_date in isset\(\) always exists and is not nullable\.$#'
identifier: isset.variable
Expand Down Expand Up @@ -25440,12 +25314,6 @@ parameters:
count: 1
path: ../../htdocs/opensurvey/wizard/create_survey.php

-
message: '#^Variable \$dolibarr_main_url_root might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/partnership/admin/website.php

-
message: '#^Left side of && is always false\.$#'
identifier: booleanAnd.leftAlwaysFalse
Expand Down
6 changes: 5 additions & 1 deletion htdocs/comm/action/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,11 @@
if (!empty($bookcalcalendars["calendars"])) {
foreach ($bookcalcalendars["calendars"] as $key => $value) {
$label = $value['label'];
$s .= '<div class="nowrap inline-block minheight30"><input '.(GETPOST('check_bookcal_calendar_'.$value['id']) ? "checked" : "").' type="checkbox" id="check_bookcal_calendar_'.$value['id'].'" name="check_bookcal_calendar_'.$value['id'].'" class="check_bookcal_calendar_'.$value['id'].'"><label for="check_bookcal_calendar_'.$value['id'].'" class="labelcalendar"> <span class="check_bookcal_calendar_'.$value['id'].'_text">'.$langs->trans("AgendaShowBookcalCalendar", $label).'</span></label> &nbsp; </div>';
$s .= '<div class="nowrap inline-block minheight30">';
$s .= '<input '.(GETPOST('check_bookcal_calendar_'.$value['id']) ? "checked" : "").' type="checkbox" id="check_bookcal_calendar_'.$value['id'].'" name="check_bookcal_calendar_'.$value['id'].'" class="check_bookcal_calendar_'.$value['id'].'">';
$s .= '<label for="check_bookcal_calendar_'.$value['id'].'" class="labelcalendar">';
$s .= '<span class="check_bookcal_calendar_'.$value['id'].'_text">'.$langs->trans("AgendaShowBookcalCalendar", $label).'</span>';
$s .= '</label> &nbsp; </div>';
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/oauth/generic_oauthcallback.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* @var Translate $langs
* @var User $user
*
* @var string $dolibarr_main_url_roott
* @var string $dolibarr_main_url_root
*/
use OAuth\Common\Storage\DoliStorage;
use OAuth\Common\Consumer\Credentials;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/oauth/github_oauthcallback.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* @var Translate $langs
* @var User $user
*
* @var string $dolibarr_main_url_roott
* @var string $dolibarr_main_url_root
*/

use OAuth\Common\Storage\DoliStorage;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/oauth/google_oauthcallback.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
* @var Translate $langs
* @var User $user
*
* @var string $dolibarr_main_url_roott
* @var string $dolibarr_main_url_root
*/

use OAuth\Common\Storage\DoliStorage;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/oauth/microsoft2_oauthcallback.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* @var Translate $langs
* @var User $user
*
* @var string $dolibarr_main_url_roott
* @var string $dolibarr_main_url_root
*/

use OAuth\Common\Storage\DoliStorage;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/oauth/microsoft_oauthcallback.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* @var Translate $langs
* @var User $user
*
* @var string $dolibarr_main_url_roott
* @var string $dolibarr_main_url_root
*/

use OAuth\Common\Storage\DoliStorage;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/oauth/stripelive_oauthcallback.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* @var Translate $langs
* @var User $user
*
* @var string $dolibarr_main_url_roott
* @var string $dolibarr_main_url_root
*/

use OAuth\Common\Storage\DoliStorage;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/oauth/stripetest_oauthcallback.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* @var Translate $langs
* @var User $user
*
* @var string $dolibarr_main_url_roott
* @var string $dolibarr_main_url_root
*/

use OAuth\Common\Storage\DoliStorage;
Expand Down
4 changes: 3 additions & 1 deletion htdocs/core/modules/openid_connect/callback.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@

require '../../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';

/**
* @var string $dolibarr_main_url_root
*/
// Javascript code on logon page only to detect user tz, dst_observed, dst_first, dst_second
$arrayofjs = array(
'/includes/jstz/jstz.min.js'.(empty($conf->dol_use_jmobile) ? '' : '?version='.urlencode(DOL_VERSION)),
Expand Down
2 changes: 2 additions & 0 deletions htdocs/ecm/file_card.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*
* @var string $dolibarr_main_url_root
*/

// Load translation files required by page
Expand Down
2 changes: 2 additions & 0 deletions htdocs/eventorganization/conferenceorbooth_contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*
* @var string $dolibarr_main_url_root
*/

// Load translation files required by the page
Expand Down
2 changes: 2 additions & 0 deletions htdocs/eventorganization/conferenceorbooth_document.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*
* @var string $dolibarr_main_url_root
*/

// Load translation files required by the page
Expand Down
2 changes: 2 additions & 0 deletions htdocs/eventorganization/conferenceorboothattendee_card.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*
* @var string $dolibarr_main_url_root
*/

// Load translation files required by the page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
* @var ?string $uploaddir
* @var string[] $toselect
* @var array<string,mixed> $parameters
* @var string $dolibarr_main_url_root
*/
// Protection
if (empty($objectclass) || empty($uploaddir)) {
Expand Down
7 changes: 6 additions & 1 deletion htdocs/master.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@
require_once 'filefunc.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/conf.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';

/**
* @var Translate $langs
*
* @var string $dolibarr_main_url_root
* @var string $dolibarr_main_url_root_alt
*/

if (!function_exists('is_countable')) {
/**
Expand Down
2 changes: 2 additions & 0 deletions htdocs/opensurvey/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*
* @var string $dolibarr_main_url_root
*/

// Security check
Expand Down
Loading

0 comments on commit 01297ee

Please sign in to comment.