Skip to content

Commit

Permalink
Merge pull request #32318 from frederic34/phpstan_2024_12_10
Browse files Browse the repository at this point in the history
fix phpstan
  • Loading branch information
eldy authored Dec 11, 2024
2 parents a4dd652 + 20d98ed commit 9d100ab
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 207 deletions.
168 changes: 0 additions & 168 deletions build/phpstan/phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -882,60 +882,6 @@ parameters:
count: 1
path: ../../htdocs/adherents/admin/member.php

-
message: '#^Cannot access property \$control on mixed\.$#'
identifier: property.nonObject
count: 23
path: ../../htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php

-
message: '#^Variable \$canvas might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php

-
message: '#^Variable \$this might not be defined\.$#'
identifier: variable.undefined
count: 23
path: ../../htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php

-
message: '#^Cannot access property \$control on mixed\.$#'
identifier: property.nonObject
count: 27
path: ../../htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php

-
message: '#^Variable \$canvas might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php

-
message: '#^Variable \$this might not be defined\.$#'
identifier: variable.undefined
count: 26
path: ../../htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php

-
message: '#^Cannot access property \$control on mixed\.$#'
identifier: property.nonObject
count: 30
path: ../../htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php

-
message: '#^Variable \$canvas might not be defined\.$#'
identifier: variable.undefined
count: 3
path: ../../htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php

-
message: '#^Variable \$this might not be defined\.$#'
identifier: variable.undefined
count: 28
path: ../../htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php

-
message: '#^Negated boolean expression is always true\.$#'
identifier: booleanNot.alwaysTrue
Expand Down Expand Up @@ -1638,24 +1584,6 @@ parameters:
count: 1
path: ../../htdocs/admin/oauthlogintokens.php

-
message: '#^Negated boolean expression is always false\.$#'
identifier: booleanNot.alwaysFalse
count: 5
path: ../../htdocs/admin/openid_connect.php

-
message: '#^Negated boolean expression is always true\.$#'
identifier: booleanNot.alwaysTrue
count: 5
path: ../../htdocs/admin/openid_connect.php

-
message: '#^Variable \$bc might not be defined\.$#'
identifier: variable.undefined
count: 10
path: ../../htdocs/admin/openid_connect.php

-
message: '#^Negated boolean expression is always true\.$#'
identifier: booleanNot.alwaysTrue
Expand Down Expand Up @@ -1686,30 +1614,6 @@ parameters:
count: 1
path: ../../htdocs/admin/security_file.php

-
message: '#^Parameter \#4 \$deliveryreceipt of class CSMSFile constructor expects int, array\<mixed\>\|string given\.$#'
identifier: argument.type
count: 1
path: ../../htdocs/admin/sms.php

-
message: '#^Parameter \#5 \$deferred of class CSMSFile constructor expects int, array\<mixed\>\|string given\.$#'
identifier: argument.type
count: 1
path: ../../htdocs/admin/sms.php

-
message: '#^Parameter \#6 \$priority of class CSMSFile constructor expects int, array\<mixed\>\|string given\.$#'
identifier: argument.type
count: 1
path: ../../htdocs/admin/sms.php

-
message: '#^Parameter \#7 \$class of class CSMSFile constructor expects int, array\<mixed\>\|string given\.$#'
identifier: argument.type
count: 1
path: ../../htdocs/admin/sms.php

-
message: '#^Variable \$smsfile might not be defined\.$#'
identifier: variable.undefined
Expand Down Expand Up @@ -5280,12 +5184,6 @@ parameters:
count: 1
path: ../../htdocs/compta/bank/class/paymentvarious.class.php

-
message: '#^Call to function property_exists\(\) with \$this\(PaymentVarious\) and ''fk_bank'' will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
count: 1
path: ../../htdocs/compta/bank/class/paymentvarious.class.php

-
message: '#^Property PaymentVarious\:\:\$accountid \(int\) in isset\(\) is not nullable\.$#'
identifier: isset.property
Expand Down Expand Up @@ -34242,72 +34140,6 @@ parameters:
count: 1
path: ../../scripts/emailings/reset-invalid-emails.php

-
message: '#^Variable \$conf might not be defined\.$#'
identifier: variable.undefined
count: 3
path: ../../scripts/invoices/email_unpaid_invoices_to_customers.php

-
message: '#^Variable \$hookmanager might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../scripts/invoices/email_unpaid_invoices_to_customers.php

-
message: '#^Variable \$langs might not be defined\.$#'
identifier: variable.undefined
count: 3
path: ../../scripts/invoices/email_unpaid_invoices_to_customers.php

-
message: '#^Variable \$conf might not be defined\.$#'
identifier: variable.undefined
count: 3
path: ../../scripts/invoices/email_unpaid_invoices_to_representatives.php

-
message: '#^Variable \$db might not be defined\.$#'
identifier: variable.undefined
count: 6
path: ../../scripts/invoices/email_unpaid_invoices_to_representatives.php

-
message: '#^Variable \$hookmanager might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../scripts/invoices/email_unpaid_invoices_to_representatives.php

-
message: '#^Variable \$langs might not be defined\.$#'
identifier: variable.undefined
count: 3
path: ../../scripts/invoices/email_unpaid_invoices_to_representatives.php

-
message: '#^Variable \$conf might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../scripts/invoices/rebuild_merge_pdf.php

-
message: '#^Variable \$db might not be defined\.$#'
identifier: variable.undefined
count: 3
path: ../../scripts/invoices/rebuild_merge_pdf.php

-
message: '#^Variable \$hookmanager might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../scripts/invoices/rebuild_merge_pdf.php

-
message: '#^Variable \$langs might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../scripts/invoices/rebuild_merge_pdf.php

-
message: '#^Variable \$user might not be defined\.$#'
identifier: variable.undefined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@

/**
* @var Adherent $object
* @var Canvas $this
* @var Conf $conf
* @var Translate $langs
*
* @var string $canvas
*/

// Protection to avoid direct call of template
Expand Down
7 changes: 5 additions & 2 deletions htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2010 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 Philippe Grand <philippe.grand@atoo-net.com>
/* Copyright (C) 2010 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
Expand All @@ -19,8 +19,11 @@

/**
* @var Adherent $object
* @var Canvas $this
* @var Conf $conf
* @var Translate $langs
*
* @var string $canvas
*/

// Protection to avoid direct call of template
Expand Down
7 changes: 5 additions & 2 deletions htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012-2022 Philippe Grand <philippe.grand@atoo-net.com>
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012-2022 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
Expand All @@ -19,9 +19,12 @@

/**
* @var Adherent $object
* @var Canvas $this
* @var Conf $conf
* @var Translate $langs
* @var User $user
*
* @var string $canvas
*/

// Protection to avoid direct call of template
Expand Down
40 changes: 15 additions & 25 deletions htdocs/admin/openid_connect.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@
* @var User $user
*/

$langs->load("admin");
$langs->load("openidconnect");
$langs->loadLangs(["admin", "openidconnect"]);

if (!$user->admin) accessforbidden();
if (!$user->admin) {
accessforbidden();
}

$action = GETPOST('action', 'alpha');

Expand Down Expand Up @@ -143,8 +144,6 @@
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="set">';

$var=true;

print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameters").'</td>'."\n";
Expand All @@ -153,89 +152,79 @@
print "</tr>\n";

// MAIN_AUTHENTICATION_OIDC_LOGIN_CLAIM
$var = !$var;
print '<tr ' . $bc[$var] . '>' . "\n";
print '<tr class="oddeven">' . "\n";
print '<td>'.$langs->trans("MainAuthenticationOidcLoginClaimName").'</td>'."\n";
print '<td>'.$langs->trans("MainAuthenticationOidcLoginClaimDesc").'</td>'."\n";
print '<td align="right">' . "\n";
print '<input name="MAIN_AUTHENTICATION_OIDC_LOGIN_CLAIM" id="MAIN_AUTHENTICATION_OIDC_LOGIN_CLAIM" class="minwidth300" value="'.dol_escape_htmltag((GETPOSTISSET('MAIN_AUTHENTICATION_OIDC_LOGIN_CLAIM') ? GETPOST('MAIN_AUTHENTICATION_OIDC_LOGIN_CLAIM', 'nohtml') : (!empty($conf->global->MAIN_AUTHENTICATION_OIDC_LOGIN_CLAIM) ? getDolGlobalString("MAIN_AUTHENTICATION_OIDC_LOGIN_CLAIM") : ''))).'"></td></tr>';
print '</td></tr>' . "\n";

// MAIN_AUTHENTICATION_OIDC_CLIENT_ID
$var = !$var;
print '<tr ' . $bc[$var] . '>' . "\n";
print '<tr class="oddeven">' . "\n";
print '<td>'.$langs->trans("MainAuthenticationOidcClientIdName").'</td>'."\n";
print '<td>'.$langs->trans("MainAuthenticationOidcClientIdDesc").'</td>'."\n";
print '<td align="right">' . "\n";
print '<input name="MAIN_AUTHENTICATION_OIDC_CLIENT_ID" id="MAIN_AUTHENTICATION_OIDC_CLIENT_ID" class="minwidth300" value="'.dol_escape_htmltag((GETPOSTISSET('MAIN_AUTHENTICATION_OIDC_CLIENT_ID') ? GETPOST('MAIN_AUTHENTICATION_OIDC_CLIENT_ID', 'nohtml') : (!empty($conf->global->MAIN_AUTHENTICATION_OIDC_CLIENT_ID) ? getDolGlobalString("MAIN_AUTHENTICATION_OIDC_CLIENT_ID") : ''))).'"></td></tr>';
print '</td></tr>' . "\n";

// MAIN_AUTHENTICATION_OIDC_CLIENT_SECRET
$var = !$var;
print '<tr ' . $bc[$var] . '>' . "\n";
print '<tr class="oddeven">' . "\n";
print '<td>'.$langs->trans("MainAuthenticationOidcClientSecretName").'</td>'."\n";
print '<td>'.$langs->trans("MainAuthenticationOidcClientSecretDesc").'</td>'."\n";
print '<td align="right">' . "\n";
print '<input type="password" name="MAIN_AUTHENTICATION_OIDC_CLIENT_SECRET" id="MAIN_AUTHENTICATION_OIDC_CLIENT_SECRET" class="minwidth300" value="'.dol_escape_htmltag((GETPOSTISSET('MAIN_AUTHENTICATION_OIDC_CLIENT_SECRET') ? GETPOST('MAIN_AUTHENTICATION_OIDC_CLIENT_SECRET', 'nohtml') : (!empty($conf->global->MAIN_AUTHENTICATION_OIDC_CLIENT_SECRET) ? getDolGlobalString("MAIN_AUTHENTICATION_OIDC_CLIENT_SECRET") : ''))).'"></td></tr>';
print '</td></tr>' . "\n";

// MAIN_AUTHENTICATION_OIDC_SCOPES
$var = !$var;
print '<tr ' . $bc[$var] . '>' . "\n";
print '<tr class="oddeven">' . "\n";
print '<td>'.$langs->trans("MainAuthenticationOidcScopesName").'</td>'."\n";
print '<td>'.$langs->trans("MainAuthenticationOidcScopesDesc").'</td>'."\n";
print '<td align="right">' . "\n";
print '<input name="MAIN_AUTHENTICATION_OIDC_SCOPES" id="MAIN_AUTHENTICATION_OIDC_SCOPES" class="minwidth300" value="'.dol_escape_htmltag((GETPOSTISSET('MAIN_AUTHENTICATION_OIDC_SCOPES') ? GETPOST('MAIN_AUTHENTICATION_OIDC_SCOPES', 'nohtml') : (!empty($conf->global->MAIN_AUTHENTICATION_OIDC_SCOPES) ? getDolGlobalString("MAIN_AUTHENTICATION_OIDC_SCOPES") : ''))).'"></td></tr>';
print '</td></tr>' . "\n";

// MAIN_AUTHENTICATION_OIDC_AUTHORIZE_URL
$var = !$var;
print '<tr ' . $bc[$var] . '>' . "\n";
print '<tr class="oddeven">' . "\n";
print '<td>'.$langs->trans("MainAuthenticationOidcAuthorizeUrlName").'</td>'."\n";
print '<td>'.$langs->trans("MainAuthenticationOidcAuthorizeUrlDesc").'</td>'."\n";
print '<td align="right">' . "\n";
print '<input name="MAIN_AUTHENTICATION_OIDC_AUTHORIZE_URL" id="MAIN_AUTHENTICATION_OIDC_AUTHORIZE_URL" class="minwidth300" value="'.dol_escape_htmltag((GETPOSTISSET('MAIN_AUTHENTICATION_OIDC_AUTHORIZE_URL') ? GETPOST('MAIN_AUTHENTICATION_OIDC_AUTHORIZE_URL', 'nohtml') : (!empty($conf->global->MAIN_AUTHENTICATION_OIDC_AUTHORIZE_URL) ? getDolGlobalString("MAIN_AUTHENTICATION_OIDC_AUTHORIZE_URL") : ''))).'"></td></tr>';
print '</td></tr>' . "\n";

// MAIN_AUTHENTICATION_OIDC_TOKEN_URL
$var = !$var;
print '<tr ' . $bc[$var] . '>' . "\n";
print '<tr class="oddeven">' . "\n";
print '<td>'.$langs->trans("MainAuthenticationOidcTokenUrlName").'</td>'."\n";
print '<td>'.$langs->trans("MainAuthenticationOidcTokenUrlDesc").'</td>'."\n";
print '<td align="right">' . "\n";
print '<input name="MAIN_AUTHENTICATION_OIDC_TOKEN_URL" id="MAIN_AUTHENTICATION_OIDC_TOKEN_URL" class="minwidth300" value="'.dol_escape_htmltag((GETPOSTISSET('MAIN_AUTHENTICATION_OIDC_TOKEN_URL') ? GETPOST('MAIN_AUTHENTICATION_OIDC_TOKEN_URL', 'nohtml') : (!empty($conf->global->MAIN_AUTHENTICATION_OIDC_TOKEN_URL) ? getDolGlobalString("MAIN_AUTHENTICATION_OIDC_TOKEN_URL") : ''))).'"></td></tr>';
print '</td></tr>' . "\n";

// MAIN_AUTHENTICATION_OIDC_USERINFO_URL
$var = !$var;
print '<tr ' . $bc[$var] . '>' . "\n";
print '<tr class="oddeven">' . "\n";
print '<td>'.$langs->trans("MainAuthenticationOidcUserinfoUrlName").'</td>'."\n";
print '<td>'.$langs->trans("MainAuthenticationOidcUserinfoUrlDesc").'</td>'."\n";
print '<td align="right">' . "\n";
print '<input name="MAIN_AUTHENTICATION_OIDC_USERINFO_URL" id="MAIN_AUTHENTICATION_OIDC_USERINFO_URL" class="minwidth300" value="'.dol_escape_htmltag((GETPOSTISSET('MAIN_AUTHENTICATION_OIDC_USERINFO_URL') ? GETPOST('MAIN_AUTHENTICATION_OIDC_USERINFO_URL', 'nohtml') : (!empty($conf->global->MAIN_AUTHENTICATION_OIDC_USERINFO_URL) ? getDolGlobalString("MAIN_AUTHENTICATION_OIDC_USERINFO_URL") : ''))).'"></td></tr>';
print '</td></tr>' . "\n";

// MAIN_AUTHENTICATION_OIDC_LOGOUT_URL
$var = !$var;
print '<tr ' . $bc[$var] . '>' . "\n";
print '<tr class="oddeven">' . "\n";
print '<td>'.$langs->trans("MainAuthenticationOidcLogoutUrlName").'</td>'."\n";
print '<td>'.$langs->trans("MainAuthenticationOidcLogoutUrlDesc").'</td>'."\n";
print '<td align="right">' . "\n";
print '<input name="MAIN_AUTHENTICATION_OIDC_LOGOUT_URL" id="MAIN_AUTHENTICATION_OIDC_LOGOUT_URL" class="minwidth300" value="'.dol_escape_htmltag((GETPOSTISSET('MAIN_AUTHENTICATION_OIDC_LOGOUT_URL') ? GETPOST('MAIN_AUTHENTICATION_OIDC_LOGOUT_URL', 'nohtml') : (!empty($conf->global->MAIN_AUTHENTICATION_OIDC_LOGOUT_URL) ? getDolGlobalString("MAIN_AUTHENTICATION_OIDC_LOGOUT_URL") : ''))).'"></td></tr>';
print '</td></tr>' . "\n";

// REDIRECT_URL
$var = !$var;
print '<tr ' . $bc[$var] . '>' . "\n";
print '<tr class="oddeven">' . "\n";
print '<td>'.$langs->trans("MainAuthenticationOidcRedirectUrlName").'</td>'."\n";
print '<td>'.$langs->trans("MainAuthenticationOidcRedirectUrlDesc").'</td>'."\n";
print '<td align="right">' . "\n";
print '<input class="minwidth300" value="'.dol_escape_htmltag(openid_connect_get_redirect_url()).'" disabled></td></tr>';
print '</td></tr>' . "\n";

// LOGOUT_URL
$var = !$var;
print '<tr ' . $bc[$var] . '>' . "\n";
print '<tr class="oddeven">' . "\n";
print '<td>'.$langs->trans("MainAuthenticationOidcLogoutRedirectUrlName").'</td>'."\n";
print '<td>'.$langs->trans("MainAuthenticationOidcLogoutRedirectUrlDesc").'</td>'."\n";
print '<td align="right">' . "\n";
Expand All @@ -256,3 +245,4 @@
print dol_get_fiche_end();

llxFooter();
$db->close();
Loading

0 comments on commit 9d100ab

Please sign in to comment.