Skip to content

Commit

Permalink
fix phpdoc (#32097)
Browse files Browse the repository at this point in the history
* fix phpdoc

* Update accountancycategory.class.php

* fix phpstan

* fix phpstan

* fix phpstan

* fix phan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix

---------

Co-authored-by: Laurent Destailleur <[email protected]>
  • Loading branch information
frederic34 and eldy authored Nov 28, 2024
1 parent 38da445 commit 1b6ee9e
Show file tree
Hide file tree
Showing 16 changed files with 93 additions and 267 deletions.
200 changes: 1 addition & 199 deletions build/phpstan/phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -312,12 +312,6 @@ parameters:
count: 4
path: ../../htdocs/accountancy/class/accountancycategory.class.php

-
message: '#^Property AccountancyCategory\:\:\$sdcpermonth type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: ../../htdocs/accountancy/class/accountancycategory.class.php

-
message: '#^Property AccountancyCategory\:\:\$sens \(int\) in isset\(\) is not nullable\.$#'
identifier: isset.property
Expand Down Expand Up @@ -1488,18 +1482,6 @@ parameters:
count: 1
path: ../../htdocs/admin/mails.php

-
message: '#^Right side of && is always true\.$#'
identifier: booleanAnd.rightAlwaysTrue
count: 3
path: ../../htdocs/admin/mails.php

-
message: '#^Ternary operator condition is always false\.$#'
identifier: ternary.alwaysFalse
count: 3
path: ../../htdocs/admin/mails.php

-
message: '#^Variable \$text in empty\(\) always exists and is not falsy\.$#'
identifier: empty.variable
Expand Down Expand Up @@ -17382,24 +17364,6 @@ parameters:
count: 2
path: ../../htdocs/core/tpl/list_print_total.tpl.php

-
message: '#^Variable \$action might not be defined\.$#'
identifier: variable.undefined
count: 5
path: ../../htdocs/core/tpl/object_currency_amount.tpl.php

-
message: '#^Variable \$object might not be defined\.$#'
identifier: variable.undefined
count: 3
path: ../../htdocs/core/tpl/object_currency_amount.tpl.php

-
message: '#^Variable \$usercancreate might not be defined\.$#'
identifier: variable.undefined
count: 4
path: ../../htdocs/core/tpl/object_currency_amount.tpl.php

-
message: '#^Left side of && is always true\.$#'
identifier: booleanAnd.leftAlwaysTrue
Expand Down Expand Up @@ -25026,18 +24990,6 @@ parameters:
count: 2
path: ../../htdocs/modulebuilder/template/myobject_agenda.php

-
message: '#^If condition is always false\.$#'
identifier: if.alwaysFalse
count: 1
path: ../../htdocs/modulebuilder/template/myobject_agenda.php

-
message: '#^Negated boolean expression is always false\.$#'
identifier: booleanNot.alwaysFalse
count: 1
path: ../../htdocs/modulebuilder/template/myobject_agenda.php

-
message: '#^Negated boolean expression is always true\.$#'
identifier: booleanNot.alwaysTrue
Expand All @@ -25059,19 +25011,7 @@ parameters:
-
message: '#^If condition is always false\.$#'
identifier: if.alwaysFalse
count: 3
path: ../../htdocs/modulebuilder/template/myobject_card.php

-
message: '#^If condition is always true\.$#'
identifier: if.alwaysTrue
count: 1
path: ../../htdocs/modulebuilder/template/myobject_card.php

-
message: '#^Negated boolean expression is always false\.$#'
identifier: booleanNot.alwaysFalse
count: 1
count: 2
path: ../../htdocs/modulebuilder/template/myobject_card.php

-
Expand Down Expand Up @@ -25104,30 +25044,6 @@ parameters:
count: 1
path: ../../htdocs/modulebuilder/template/myobject_card.php

-
message: '#^Right side of && is always true\.$#'
identifier: booleanAnd.rightAlwaysTrue
count: 5
path: ../../htdocs/modulebuilder/template/myobject_card.php

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

-
message: '#^If condition is always false\.$#'
identifier: if.alwaysFalse
count: 1
path: ../../htdocs/modulebuilder/template/myobject_contact.php

-
message: '#^Negated boolean expression is always false\.$#'
identifier: booleanNot.alwaysFalse
count: 1
path: ../../htdocs/modulebuilder/template/myobject_contact.php

-
message: '#^Negated boolean expression is always true\.$#'
identifier: booleanNot.alwaysTrue
Expand All @@ -25146,24 +25062,6 @@ parameters:
count: 1
path: ../../htdocs/modulebuilder/template/myobject_contact.php

-
message: '#^Right side of && is always true\.$#'
identifier: booleanAnd.rightAlwaysTrue
count: 2
path: ../../htdocs/modulebuilder/template/myobject_contact.php

-
message: '#^If condition is always false\.$#'
identifier: if.alwaysFalse
count: 1
path: ../../htdocs/modulebuilder/template/myobject_document.php

-
message: '#^Negated boolean expression is always false\.$#'
identifier: booleanNot.alwaysFalse
count: 1
path: ../../htdocs/modulebuilder/template/myobject_document.php

-
message: '#^Negated boolean expression is always true\.$#'
identifier: booleanNot.alwaysTrue
Expand Down Expand Up @@ -25194,18 +25092,6 @@ parameters:
count: 1
path: ../../htdocs/modulebuilder/template/myobject_list.php

-
message: '#^If condition is always false\.$#'
identifier: if.alwaysFalse
count: 1
path: ../../htdocs/modulebuilder/template/myobject_list.php

-
message: '#^Negated boolean expression is always false\.$#'
identifier: booleanNot.alwaysFalse
count: 1
path: ../../htdocs/modulebuilder/template/myobject_list.php

-
message: '#^Negated boolean expression is always true\.$#'
identifier: booleanNot.alwaysTrue
Expand All @@ -25224,24 +25110,6 @@ parameters:
count: 1
path: ../../htdocs/modulebuilder/template/myobject_list.php

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

-
message: '#^If condition is always false\.$#'
identifier: if.alwaysFalse
count: 1
path: ../../htdocs/modulebuilder/template/myobject_note.php

-
message: '#^Negated boolean expression is always false\.$#'
identifier: booleanNot.alwaysFalse
count: 1
path: ../../htdocs/modulebuilder/template/myobject_note.php

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

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

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

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

-
message: '#^Ternary operator condition is always true\.$#'
identifier: ternary.alwaysTrue
Expand Down Expand Up @@ -32748,12 +32598,6 @@ parameters:
count: 2
path: ../../htdocs/societe/price.php

-
message: '#^Variable \$extrafields might not be defined\.$#'
identifier: variable.undefined
count: 14
path: ../../htdocs/societe/price.php

-
message: '#^Variable \$prodcustprice might not be defined\.$#'
identifier: variable.undefined
Expand Down Expand Up @@ -34686,48 +34530,6 @@ parameters:
count: 2
path: ../../htdocs/variants/list.php

-
message: '#^Cannot access property \$lines on mixed\.$#'
identifier: property.nonObject
count: 1
path: ../../htdocs/variants/tpl/productattributevalueline_create.tpl.php

-
message: '#^Variable \$action might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/variants/tpl/productattributevalueline_create.tpl.php

-
message: '#^Variable \$hookmanager might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/variants/tpl/productattributevalueline_create.tpl.php

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

-
message: '#^Variable \$this might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/variants/tpl/productattributevalueline_create.tpl.php

-
message: '#^Variable \$action might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/variants/tpl/productattributevalueline_title.tpl.php

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

-
message: '#^Call to function is_numeric\(\) with int will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
Expand Down
4 changes: 2 additions & 2 deletions htdocs/accountancy/class/accountancycategory.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* Copyright (C) 2016 Jamal Elbaz <[email protected]>
* Copyright (C) 2016-2017 Alexandre Spangaro <[email protected]>
* Copyright (C) 2018-2024 Frédéric France <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -129,7 +129,7 @@ class AccountancyCategory // extends CommonObject
public $sdc;

/**
* @var array Sum debit credit per month
* @var array<string,float> Sum debit credit per month
*/
public $sdcpermonth;

Expand Down
10 changes: 5 additions & 5 deletions htdocs/admin/mails.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

$usersignature = $user->signature;
// For action = test or send, we ensure that content is not html, even for signature, because for this we want a test with NO html.
if ($action == 'test' || ($action == 'send' && $trackid = 'test')) {
if ($action == 'test' || ($action == 'send' && $trackid == 'test')) {
$usersignature = dol_string_nohtmltag($usersignature, 2);
}

Expand Down Expand Up @@ -1003,7 +1003,7 @@ function change_smtp_auth_method() {

if (!getDolGlobalString('MAIN_DISABLE_ALL_MAILS')) {
if (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') != 'mail' || !$linuxlike) {
if (function_exists('fsockopen') && $port && $server) {
if (function_exists('fsockopen') /* && $port && $server */) { // $port and $server can't be empty
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testconnect&token='.newToken().'&date='.dol_now().'#formmailaftertstconnect">'.$langs->trans("DoTestServerAvailability").'</a>';
}
} else {
Expand Down Expand Up @@ -1044,19 +1044,19 @@ function change_smtp_auth_method() {
// mthode php mail
if (getDolGlobalString('MAIN_EXTERNAL_MAIL_SPF_STRING_TO_ADD')) { // Not defined by default. Depend on platform.
// List of string to add in SPF if the setup use the mail method. Example 'include:sendgrid.net include:spf.mydomain.com'
$text .= ($text ? '<br><br>' : '').$langs->trans("WarningPHPMailSPFDMARC");
$text .= /* ($text ? '<br><br>' : ''). */$langs->trans("WarningPHPMailSPFDMARC");
} else {
// MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS is list of IPs where email is sent from. Example: '1.2.3.4, [aaaa:bbbb:cccc:dddd]'.
if (getDolGlobalString('MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS')) {
// List of IP shown as record to add in SPF if we use the mail method
$text .= ($text ? '<br><br>' : '').$langs->trans("WarningPHPMailSPFDMARC");
$text .= /* ($text ? '<br><br>' : ''). */$langs->trans("WarningPHPMailSPFDMARC");
}
}
} else {
// method smtps or swiftmail
if (getDolGlobalString('MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD')) { // Should be required only if you have preset the Dolibarr to use your own SMTP and you want to warn users to update their domain name to match your SMTP server.
// List of string to add in SPF if we use the smtp method. Example 'include:spf.mydomain.com'
$text .= ($text ? '<br><br>' : '').$langs->trans("WarningPHPMailSPF", getDolGlobalString('MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD'));
$text .= /* ($text ? '<br><br>' : ''). */$langs->trans("WarningPHPMailSPF", getDolGlobalString('MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD'));
}
if (getDolGlobalString('MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS')) { // Not defined by default. Depend on platform.
// List of IP shown as record to add as allowed IP if we use the smtp method. Value is '1.2.3.4, [aaaa:bbbb:cccc:dddd]'
Expand Down
2 changes: 1 addition & 1 deletion htdocs/contact/perso.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@

$result = $object->update_perso($id, $user);
if ($result > 0) {
$object->oldcopy = dol_clone($object, 2); // @phan-suppres-current-line PhanTypeMismatchProperty
$object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty

// Logo/Photo save
$dir = $conf->societe->dir_output.'/contact/'.get_exdir($object->id, 0, 0, 1, $object, 'contact').'/photos';
Expand Down
7 changes: 6 additions & 1 deletion htdocs/core/tpl/object_currency_amount.tpl.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2024 Laurent Destailleur <[email protected]>
/* Copyright (C) 2024 Laurent Destailleur <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
Expand All @@ -24,8 +24,13 @@
* $langs
*/
/**
* @var CommonObject $object
* @var Conf $conf
* @var Form $form
* @var Translate $langs
*
* @var string $action
* @var int $usercancreate
*/
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
Expand Down
2 changes: 1 addition & 1 deletion htdocs/modulebuilder/template/myobject_agenda.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@

// There is several ways to check permission.
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
$enablepermissioncheck = 0;
$enablepermissioncheck = getDolGlobalInt('MYMODULE_ENABLE_PERMISSION_CHECK');
if ($enablepermissioncheck) {
$permissiontoread = $user->hasRight('mymodule', 'myobject', 'read');
$permissiontoadd = $user->hasRight('mymodule', 'myobject', 'write');
Expand Down
2 changes: 1 addition & 1 deletion htdocs/modulebuilder/template/myobject_card.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@

// There is several ways to check permission.
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
$enablepermissioncheck = 0;
$enablepermissioncheck = getDolGlobalInt('MYMODULE_ENABLE_PERMISSION_CHECK');
if ($enablepermissioncheck) {
$permissiontoread = $user->hasRight('mymodule', 'myobject', 'read');
$permissiontoadd = $user->hasRight('mymodule', 'myobject', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
Expand Down
2 changes: 1 addition & 1 deletion htdocs/modulebuilder/template/myobject_contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@

// There is several ways to check permission.
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
$enablepermissioncheck = 0;
$enablepermissioncheck = getDolGlobalInt('MYMODULE_ENABLE_PERMISSION_CHECK');
if ($enablepermissioncheck) {
$permissiontoread = $user->hasRight('mymodule', 'myobject', 'read');
$permissiontoadd = $user->hasRight('mymodule', 'myobject', 'write');
Expand Down
Loading

0 comments on commit 1b6ee9e

Please sign in to comment.