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: Enable phan on modulebuilder #30652

Merged
merged 13 commits into from
Aug 18, 2024
Merged
8 changes: 5 additions & 3 deletions dev/tools/phan/baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,10 @@ return [
'htdocs/core/lib/intracommreport.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'],
'htdocs/core/lib/invoice.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'],
'htdocs/core/lib/invoice2.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/lib/ldap.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'],
'htdocs/core/lib/ldap.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType', 'PhanPluginUnknownArrayFunctionParamType'],
'htdocs/core/lib/memory.lib.php' => ['PhanTypeMismatchDimFetch'],
'htdocs/core/lib/multicurrency.lib.php' => ['PhanPluginUnknownArrayFunctionParamType'],
'htdocs/core/lib/pdf.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/core/lib/loan.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'],
'htdocs/core/lib/mailmanspip.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'],
'htdocs/core/lib/memory.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType', 'PhanTypeMismatchDimFetch'],
Expand All @@ -598,7 +601,7 @@ return [
'htdocs/core/lib/resource.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'],
'htdocs/core/lib/salaries.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'],
'htdocs/core/lib/security.lib.php' => ['PhanPluginUnknownArrayFunctionParamType'],
'htdocs/core/lib/security2.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredVariable'],
'htdocs/core/lib/security2.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredVariable'],
'htdocs/core/lib/sendings.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/core/lib/signature.lib.php' => ['PhanPossiblyUndeclaredVariable'],
'htdocs/core/lib/socialnetwork.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'],
Expand Down Expand Up @@ -975,7 +978,6 @@ return [
'htdocs/margin/lib/margins.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'],
'htdocs/margin/productMargins.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/master.inc.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/modulebuilder/index.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'],
'htdocs/mrp/class/api_mos.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
'htdocs/mrp/class/mo.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchProperty'],
'htdocs/mrp/lib/mrp.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'],
Expand Down
4 changes: 2 additions & 2 deletions dev/tools/phan/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,12 +323,12 @@
// mymodule seen in cti, but not in git.
.'|htdocs/custom/mymodule/.*' // @phpstan-ignore-line
.'|htdocs/.*/canvas/.*/tpl/.*.tpl.php' // @phpstan-ignore-line
.'|htdocs/modulebuilder/template/.*' // @phpstan-ignore-line
//.'|htdocs/modulebuilder/template/.*' // @phpstan-ignore-line
// Included as stub (better analysis)
.'|htdocs/includes/nusoap/.*' // @phpstan-ignore-line
// Included as stub (old version + incompatible typing hints)
.'|htdocs/includes/restler/.*' // @phpstan-ignore-line
// Included as stub (did not seem properly analysed by phan without it)
// Included as stub (did not seem properly analyzed by phan without it)
.'|htdocs/includes/stripe/.*' // @phpstan-ignore-line
.'|htdocs/conf/conf.php' // @phpstan-ignore-line
// .'|htdocs/[^h].*/.*' // For testing @phpstan-ignore-line
Expand Down
6 changes: 5 additions & 1 deletion htdocs/api/class/api.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,14 @@ protected function _filterObjectProperties($object, $properties)

// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
* Clean sensitive object data
* @phpstan-template T of Object
*
* @param Object $object Object to clean
* @return Object Object with cleaned properties
*
* @phpstan-param T $object
* @phpstan-return T
*/
protected function _cleanObjectDatas($object)
{
Expand Down
11 changes: 6 additions & 5 deletions htdocs/core/boxes/box_accountancy_last_manual_entries.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright (C) 2004-2009 Laurent Destailleur <[email protected]>
* Copyright (C) 2005-2009 Regis Houssin <[email protected]>
* Copyright (C) 2019 Alexandre Spangaro <[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 @@ -133,15 +134,15 @@ public function loadBox($max = 5)
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text'=> '<span class="opacitymedium">'.$langs->trans("NoRecordedManualEntries").'</span>'
'text' => '<span class="opacitymedium">'.$langs->trans("NoRecordedManualEntries").'</span>'
);
}

$this->db->free($result);
} else {
$this->info_box_contents[0][0] = array(
'td' => '',
'maxlength'=>500,
'maxlength' => 500,
'text' => ($this->db->error().' sql='.$sql),
);
}
Expand All @@ -156,9 +157,9 @@ public function loadBox($max = 5)
/**
* Method to show box
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @param ?array{text?:string,sublink?:string,subpicto:?string,nbcol?:int,limit?:int,subclass?:string,graph?:string} $head Array with properties of box title
* @param ?array<array<array{tr?:string,td?:string,target?:string,text?:string,text2?:string,textnoformat?:string,tooltip?:string,logo?:string,url?:string,maxlength?:string}>> $contents Array with properties of box lines
* @param int<0,1> $nooutput No print, only return string
* @return string
*/
public function showBox($head = null, $contents = null, $nooutput = 0)
Expand Down
7 changes: 4 additions & 3 deletions htdocs/core/boxes/box_accountancy_suspense_account.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright (C) 2004-2009 Laurent Destailleur <[email protected]>
* Copyright (C) 2005-2009 Regis Houssin <[email protected]>
* Copyright (C) 2019 Alexandre Spangaro <[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 @@ -109,9 +110,9 @@ public function loadBox()
/**
* Method to show box
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @param ?array{text?:string,sublink?:string,subpicto:?string,nbcol?:int,limit?:int,subclass?:string,graph?:string} $head Array with properties of box title
* @param ?array<array<array{tr?:string,td?:string,target?:string,text?:string,text2?:string,textnoformat?:string,tooltip?:string,logo?:string,url?:string,maxlength?:string}>> $contents Array with properties of box lines
* @param int<0,1> $nooutput No print, only return string
* @return string
*/
public function showBox($head = null, $contents = null, $nooutput = 0)
Expand Down
13 changes: 7 additions & 6 deletions htdocs/core/boxes/box_actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Copyright (C) 2005-2011 Regis Houssin <[email protected]>
* Copyright (C) 2014 Charles-Fr BENKE <[email protected]>
* Copyright (C) 2015 Frederic France <[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 @@ -142,7 +143,7 @@ public function loadBox($max = 5)
$this->info_box_contents[$line][0] = array(
'td' => 'class="tdoverflowmax200"',
'text' => $actionstatic->getNomUrl(1),
'text2'=> $late,
'text2' => $late,
'asis' => 1
);

Expand Down Expand Up @@ -176,15 +177,15 @@ public function loadBox($max = 5)
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text'=> '<span class="opacitymedium">'.$langs->trans("NoActionsToDo").'</span>'
'text' => '<span class="opacitymedium">'.$langs->trans("NoActionsToDo").'</span>'
);
}

$this->db->free($result);
} else {
$this->info_box_contents[0][0] = array(
'td' => '',
'maxlength'=>500,
'maxlength' => 500,
'text' => ($this->db->error().' sql='.$sql)
);
}
Expand All @@ -199,9 +200,9 @@ public function loadBox($max = 5)
/**
* Method to show box
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @param ?array{text?:string,sublink?:string,subpicto:?string,nbcol?:int,limit?:int,subclass?:string,graph?:string} $head Array with properties of box title
* @param ?array<array<array{tr?:string,td?:string,target?:string,text?:string,text2?:string,textnoformat?:string,tooltip?:string,logo?:string,url?:string,maxlength?:string}>> $contents Array with properties of box lines
* @param int<0,1> $nooutput No print, only return string
* @return string
*/
public function showBox($head = null, $contents = null, $nooutput = 0)
Expand Down
13 changes: 7 additions & 6 deletions htdocs/core/boxes/box_actions_future.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Copyright (C) 2005-2011 Regis Houssin <[email protected]>
* Copyright (C) 2014 Charles-Fr BENKE <[email protected]>
* Copyright (C) 2015 Frederic France <[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 @@ -145,7 +146,7 @@ public function loadBox($max = 5)
$this->info_box_contents[$line][0] = array(
'td' => 'class="tdoverflowmax200"',
'text' => $actionstatic->getNomUrl(1),
'text2'=> $late,
'text2' => $late,
'asis' => 1
);

Expand Down Expand Up @@ -179,15 +180,15 @@ public function loadBox($max = 5)
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text'=> '<span class="opacitymedium">'.$langs->trans("NoActionsToDo").'</span>'
'text' => '<span class="opacitymedium">'.$langs->trans("NoActionsToDo").'</span>'
);
}

$this->db->free($result);
} else {
$this->info_box_contents[0][0] = array(
'td' => '',
'maxlength'=>500,
'maxlength' => 500,
'text' => ($this->db->error().' sql='.$sql)
);
}
Expand All @@ -202,9 +203,9 @@ public function loadBox($max = 5)
/**
* Method to show box
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @param ?array{text?:string,sublink?:string,subpicto:?string,nbcol?:int,limit?:int,subclass?:string,graph?:string} $head Array with properties of box title
* @param ?array<array<array{tr?:string,td?:string,target?:string,text?:string,text2?:string,textnoformat?:string,tooltip?:string,logo?:string,url?:string,maxlength?:string}>> $contents Array with properties of box lines
* @param int<0,1> $nooutput No print, only return string
* @return string
*/
public function showBox($head = null, $contents = null, $nooutput = 0)
Expand Down
19 changes: 10 additions & 9 deletions htdocs/core/boxes/box_activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* Copyright (C) 2012 Charles-François BENKE <[email protected]>
* Copyright (C) 2005-2015 Laurent Destailleur <[email protected]>
* Copyright (C) 2014-2021 Frederic France <[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 @@ -88,7 +89,7 @@ public function loadBox($max = 5)
$textHead = $langs->trans("Activity").' - '.$langs->trans("LastXMonthRolling", $nbofperiod);
$this->info_box_head = array(
'text' => $textHead,
'limit'=> dol_strlen($textHead),
'limit' => dol_strlen($textHead),
);

// compute the year limit to show
Expand Down Expand Up @@ -175,7 +176,7 @@ public function loadBox($max = 5)
if (count($data) == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text'=>'<span class="opacitymedium">'.$langs->trans("NoRecordedProposals").'</span>',
'text' => '<span class="opacitymedium">'.$langs->trans("NoRecordedProposals").'</span>',
);
$line++;
}
Expand Down Expand Up @@ -235,7 +236,7 @@ public function loadBox($max = 5)

$this->info_box_contents[$line][1] = array(
'td' => '',
'text' =>$langs->trans("Orders")."&nbsp;".$commandestatic->LibStatut($data[$j]->fk_statut, 0, 0),
'text' => $langs->trans("Orders")."&nbsp;".$commandestatic->LibStatut($data[$j]->fk_statut, 0, 0),
);

$this->info_box_contents[$line][2] = array(
Expand All @@ -261,7 +262,7 @@ public function loadBox($max = 5)
if (count($data) == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text'=>$langs->trans("NoRecordedOrders"),
'text' => $langs->trans("NoRecordedOrders"),
);
$line++;
}
Expand Down Expand Up @@ -349,7 +350,7 @@ public function loadBox($max = 5)
if (count($data) == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text'=>$langs->trans("NoRecordedInvoices"),
'text' => $langs->trans("NoRecordedInvoices"),
);
$line++;
}
Expand Down Expand Up @@ -418,7 +419,7 @@ public function loadBox($max = 5)
if (count($data) == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text'=>$langs->trans("NoRecordedUnpaidInvoices"),
'text' => $langs->trans("NoRecordedUnpaidInvoices"),
);
$line++;
}
Expand All @@ -439,9 +440,9 @@ public function loadBox($max = 5)
/**
* Method to show box
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @param ?array{text?:string,sublink?:string,subpicto:?string,nbcol?:int,limit?:int,subclass?:string,graph?:string} $head Array with properties of box title
* @param ?array<array<array{tr?:string,td?:string,target?:string,text?:string,text2?:string,textnoformat?:string,tooltip?:string,logo?:string,url?:string,maxlength?:string}>> $contents Array with properties of box lines
* @param int<0,1> $nooutput No print, only return string
* @return string
*/
public function showBox($head = null, $contents = null, $nooutput = 0)
Expand Down
6 changes: 3 additions & 3 deletions htdocs/core/boxes/box_birthdays.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ public function loadBox($max = 20)
/**
* Method to show box
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @param ?array{text?:string,sublink?:string,subpicto:?string,nbcol?:int,limit?:int,subclass?:string,graph?:string} $head Array with properties of box title
* @param ?array<array<array{tr?:string,td?:string,target?:string,text?:string,text2?:string,textnoformat?:string,tooltip?:string,logo?:string,url?:string,maxlength?:string}>> $contents Array with properties of box lines
* @param int<0,1> $nooutput No print, only return string
* @return string
*/
public function showBox($head = null, $contents = null, $nooutput = 0)
Expand Down
6 changes: 3 additions & 3 deletions htdocs/core/boxes/box_birthdays_members.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ public function loadBox($max = 20)
/**
* Method to show box
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @param ?array{text?:string,sublink?:string,subpicto:?string,nbcol?:int,limit?:int,subclass?:string,graph?:string} $head Array with properties of box title
* @param ?array<array<array{tr?:string,td?:string,target?:string,text?:string,text2?:string,textnoformat?:string,tooltip?:string,logo?:string,url?:string,maxlength?:string}>> $contents Array with properties of box lines
* @param int<0,1> $nooutput No print, only return string
* @return string
*/
public function showBox($head = null, $contents = null, $nooutput = 0)
Expand Down
11 changes: 6 additions & 5 deletions htdocs/core/boxes/box_boms.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright (C) 2004-2009 Laurent Destailleur <[email protected]>
* Copyright (C) 2005-2009 Regis Houssin <[email protected]>
* Copyright (C) 2015 Frederic France <[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 @@ -151,15 +152,15 @@ public function loadBox($max = 5)
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text'=> '<span class="opacitymedium">'.$langs->trans("NoRecordedOrders").'</span>'
'text' => '<span class="opacitymedium">'.$langs->trans("NoRecordedOrders").'</span>'
);
}

$this->db->free($result);
} else {
$this->info_box_contents[0][0] = array(
'td' => '',
'maxlength'=>500,
'maxlength' => 500,
'text' => ($this->db->error().' sql='.$sql),
);
}
Expand All @@ -174,9 +175,9 @@ public function loadBox($max = 5)
/**
* Method to show box
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @param ?array{text?:string,sublink?:string,subpicto:?string,nbcol?:int,limit?:int,subclass?:string,graph?:string} $head Array with properties of box title
* @param ?array<array<array{tr?:string,td?:string,target?:string,text?:string,text2?:string,textnoformat?:string,tooltip?:string,logo?:string,url?:string,maxlength?:string}>> $contents Array with properties of box lines
* @param int<0,1> $nooutput No print, only return string
* @return string
*/
public function showBox($head = null, $contents = null, $nooutput = 0)
Expand Down
Loading
Loading