Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qual: Fix some phan typing in actions_massactions.inc.php #30733

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion dev/tools/phan/baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ return [
'htdocs/core/actions_extrafields.inc.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/actions_lineupdown.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/core/actions_linkedfiles.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/core/actions_massactions.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/core/actions_printing.inc.php' => ['PhanUndeclaredProperty'],
'htdocs/core/actions_sendmails.inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/core/actions_setmoduleoptions.inc.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable'],
Expand Down
12 changes: 12 additions & 0 deletions htdocs/core/actions_massactions.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@
@phan-var-force ?string $deliveryreceipt
';

'
@phan-var-force ?string $permissiontoread
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems duplicate of line 41 to 49

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly because this PR and changes still pending here are "old" and repeated in more recent PRs. I'll clean that up.

The main reason this PR is still open is for these phan notices:

Warning: actions_massactions.inc.php: PhanUndeclaredProperty: Reference to undeclared property \CommonObject->fk_soc
Warning: actions_massactions.inc.php: PhanUndeclaredProperty: Reference to undeclared property \User->email_aliases
Warning: actions_massactions.inc.php: PhanPossiblyUndeclaredGlobalVariable: Global variable $pagecount is possibly undeclared

I am tending to think that I should simply extract the code changes to a separate PR and close this one - the real technical debt is likely not going to be fixed until almost all of the pending phpdoc changes and false positives are identified.

@phan-var-force ?string $permissiontodelete
@phan-var-force ?string $permissiontoclose
@phan-var-force ?string $permissiontoapprove
@phan-var-force ?int[] $toselect
@phan-var-force ?string $diroutputmassaction
@phan-var-force ?string $objectlabel
@phan-var-force ?string $option
@phan-var-force ?string $deliveryreceipt
';


// Protection
if (empty($objectclass) || empty($uploaddir)) {
Expand Down Expand Up @@ -136,7 +148,7 @@
$listofobjectid[$toselectid] = $toselectid;

// Set $tmpobjectid that is ID of parent object (thirdparty or user in most cases)
$tmpobjectid = ($objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid);

Check warning on line 151 in htdocs/core/actions_massactions.inc.php

View workflow job for this annotation

GitHub Actions / phan / Run phan

actions_massactions.inc.php: PhanUndeclaredProperty: Reference to undeclared property \CommonObject->fk_soc
if ($objecttmp->element == 'societe') {
'@phan-var-force Societe $objecttmp';
$tmpobjectid = $objecttmp->id;
Expand Down Expand Up @@ -442,7 +454,7 @@
} elseif ($fromtype === 'company') {
$from = getDolGlobalString('MAIN_INFO_SOCIETE_NOM') . ' <' . getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>';
} elseif (preg_match('/user_aliases_(\d+)/', $fromtype, $reg)) {
$tmp = explode(',', $user->email_aliases);

Check warning on line 457 in htdocs/core/actions_massactions.inc.php

View workflow job for this annotation

GitHub Actions / phan / Run phan

actions_massactions.inc.php: PhanUndeclaredProperty: Reference to undeclared property \User-&gt;email_aliases
$from = trim($tmp[((int) $reg[1] - 1)]);
} elseif (preg_match('/global_aliases_(\d+)/', $fromtype, $reg)) {
$tmp = explode(',', getDolGlobalString('MAIN_INFO_SOCIETE_MAIL_ALIASES'));
Expand Down Expand Up @@ -924,7 +936,7 @@
if ($month) {
$filename .= '_'.$month;
}
if ($pagecount) {

Check warning on line 939 in htdocs/core/actions_massactions.inc.php

View workflow job for this annotation

GitHub Actions / phan / Run phan

actions_massactions.inc.php: PhanPossiblyUndeclaredGlobalVariable: Global variable $pagecount is possibly undeclared
$now = dol_now();
$file = $diroutputmassaction.'/'.$filename.'_'.dol_print_date($now, 'dayhourlog').'.pdf';
$pdf->Output($file, 'F');
Expand Down
Loading