Skip to content

Commit

Permalink
Qual: Fix PhanPluginUnknownObjectMethodCall ("part 1") (#30563)
Browse files Browse the repository at this point in the history
* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add typing hint to fix phan notice.

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add typing hint in phan config to fix phan notice.

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint to fix phan notice.

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for linkedObjectBlock

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for linkedObjectBlock

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for linkedObjects

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for PhanPluginUnknownObjectMethodCall

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for PhanPluginUnknownObjectMethodCall

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for PhanPluginUnknownObjectMethodCall

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for PhanPluginUnknownObjectMethodCall

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for PhanPluginUnknownObjectMethodCall

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for PhanPluginUnknownObjectMethodCall

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for PhanPluginUnknownObjectMethodCall

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for PhanPluginUnknownObjectMethodCall

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for PhanPluginUnknownObjectMethodCall

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for PhanPluginUnknownObjectMethodCall

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for PhanPluginUnknownObjectMethodCall

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for PhanPluginUnknownObjectMethodCall

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for PhanPluginUnknownObjectMethodCall

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for PhanPluginUnknownObjectMethodCall

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for PhanPluginUnknownObjectMethodCall

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for PhanPluginUnknownObjectMethodCall

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for PhanPluginUnknownObjectMethodCall

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for PhanPluginUnknownObjectMethodCall

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for PhanPluginUnknownObjectMethodCall

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for PhanPluginUnknownObjectMethodCall

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for PhanPluginUnknownObjectMethodCall

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for PhanPluginUnknownObjectMethodCall

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for PhanPluginUnknownObjectMethodCall

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for PhanPluginUnknownObjectMethodCall

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for PhanPluginUnknownObjectMethodCall

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for PhanPluginUnknownObjectMethodCall

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for PhanPluginUnknownObjectMethodCall

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for PhanPluginUnknownObjectMethodCall

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for PhanPluginUnknownObjectMethodCall

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for PhanPluginUnknownObjectMethodCall

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for PhanPluginUnknownObjectMethodCall

* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

# Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints)

Add/improve typing hint for PhanPluginUnknownObjectMethodCall

* Fix: MemberNumRefNumbers getExample does not take any arguments

Found thanks to adding the typing for phan!

* Qual: Correct forced type for $module

* Qual: Ignore phan false positive

* Qual: phan/Correct module type and ignore false positive

* Qual: phan/Ignore false positive

* Qual: phan/Ignore false positive, replace depr.prop with method

* Qual: Fix typing for count by adding is_array check

* Qual: replace depr.prop `nom` with method

* Qual: phan/Correct module type and ignore false positive

* Qual: phan/Correct module type and ignore false positive

* Qual: phan/Correct module type and ignore false positive

* Qual: phan/Fix depr.prop with getter and ignore false positive

* Qual: phan/Correct module type and ignore false positive

* Qual: phan/Correct module type and ignore false positive

* Qual: phan/Correct module type and ignore false positive

* Qual: Improve typing for mymodule template

* Make info method arguments match calls

* Make PrintingDriver abstract class because we added abstract methods

* Add phpdoc typing for phan

* Update getExample function signature for compatibility

* Update getExample function signature for compatibility

* Update getExample function signature for compatibility

* Update header wit correct information

* Update getExample method signature

* Update getExample method signature

* Correct reference to class in comment

* Force php phan typing for numbering modules

* Correct $_GLOBALS to $GLOBALS

* Add phpdoc to indicat type of properties

* Correct default to null

* Improve getNextValue typehint

* Improve getNextValue typehint

* Qual: Improve ModeleNumRefTakepos typing

* Qual: Improve ModeleNumRefRecruitmentJobPosition typing

* Fix default for $langs

* Do not use non-existing ModeleNumRefTakepos::nom

* Allow getNextValue argument to be null

* Correct $_GLOBAL into $GLOBALS

* Improve typing for ldap functions

* Allow null for outputlangs argument

* Improve typing for printOriginLine

* Improve typing for linkedObject access

* Fix PhanTypeMismatchArgumentNullableInternal and optimize

* Fix PhanPossiblyUndeclaredVariable by setting default value

* Ignore PhanPluginDuplicateExpressionAssignmentOperation - needs PHP7.4

* getToolTip does not accept null, changed to ''

* Improve getNextValue typing

* Change PrintingDriver back to normal class (instantiated)

And add errors for functions that should be overloaded

* Adjust pringOriginLine typing to match parent

* Fix phpdoc for getNextValue

* Fix phan typing

* Add/Improve phpdoc typing hints

* Qual: Adjustments to match typing

* Update typing for unit, use GETPOSTINT

* ModeleNumRefTask needs Project

* Fix several notices appearing after update from develop

* Index for choices is int, use GETPOSTINT

* Qual: Ignore empty foreach

* Force BOMLine on object line

* phan typing to indicate that linked objects are BOM

* Type the correct variable name (phan)

* Add typing for $langs

* Type to CommonNumRefGenerator (no class for availabilities)

* Resolve several phan notices after update from dev branch

* Extra typing fixes

* Move common attributes to parent class (phan)

* Add typing to Calendar class

* Improve typing hints

* Add typing to pdf_eagle_proforma

* Qual: Add typing for token in generic_oauthcallback.php

* Add typing for objMod

* Correct getNextValue function signature (phpstan)

* Fix typing (phpstan)

* Update version declarations (fix phpstan)

* Fix phpstan typing issues

* Adjust typing (phpstan)

* Qual: Update baseline & conf to detect 25% of PhanPluginUnknownObjectMethodCall
  • Loading branch information
mdeweerd authored Aug 17, 2024
1 parent 52fdd19 commit 75ed925
Show file tree
Hide file tree
Showing 273 changed files with 1,887 additions and 1,048 deletions.
519 changes: 300 additions & 219 deletions dev/tools/phan/baseline.txt

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions dev/tools/phan/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,17 +257,20 @@
'filtert' => 'int',
'forceall' => 'int<0,1>',
'form' => '\Form',
'formcompany' => '\FormCompany',
'hookmanager' => '\HookManager',
'inputalsopricewithtax' => 'int<0,1>',
'langs' => '\Translate',
'leftmenu' => 'string',
'linkedObjectBlock' => '\CommonObject[]', // See htdocs/core/class/html.form.class.php
'mainmenu' => 'string',
'menumanager' => '\MenuManager',
'mysoc' => '\Societe',
'nblines' => '\int',
'obj' => '\CommonObject', // Deprecated
'object_rights' => 'int|stdClass',
'objectoffield' => '\CommonObject',
'objsoc' => '\Societe',
'senderissupplier' => 'int<0,2>',
'user' => '\User',
'website' => 'string', // See discussion https://github.com/Dolibarr/dolibarr/pull/28891#issuecomment-2002268334 // Disable because Phan infers Website type
Expand Down Expand Up @@ -444,10 +447,10 @@
'PhanPluginRedundantAssignment', // Not essential, useless
'PhanPluginDuplicateCatchStatementBody', // Requires PHP7.1 - 50+ occurrences

'PhanPluginUnknownArrayMethodParamType', // Too many troubles to manage. Is enabled into config_extended only.
'PhanPluginUnknownArrayMethodReturnType', // Too many troubles to manage. Is enabled into config_extended only.
'PhanPluginUnknownArrayMethodParamType', // Too many troubles to manage. Is enabled in config_extended only.
'PhanPluginUnknownArrayMethodReturnType', // Too many troubles to manage. Is enabled in config_extended only.
'PhanUndeclaredGlobalVariable', // Too many false positives on .tpl.php files. Is enabled into config_extended only.
'PhanPluginUnknownObjectMethodCall', // False positive for some class. Is enabled into config_extended only.
// 'PhanPluginUnknownObjectMethodCall', // False positive for some class. Is enabled in config_extended only.
],
// You can put relative paths to internal stubs in this config option.
// Phan will continue using its detailed type annotations,
Expand Down
7 changes: 5 additions & 2 deletions htdocs/adherents/admin/member.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@

include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';

global $conf;

if ($action == 'set_default') {
$ret = addDocumentModel($value, $type, $label, $scandir);
$res = true;
Expand Down Expand Up @@ -181,7 +183,7 @@
}
}

$consttype = GETPOST('consttype', 'alpha');
$consttype = GETPOSTINT('consttype');
$constnote = GETPOST('constnote');
$res = dolibarr_set_const($db, $constname, $constvalue, $choices[$consttype], 0, $constnote, $conf->entity);

Expand Down Expand Up @@ -295,7 +297,7 @@
print '<tr class="oddeven">'."\n";
print '<td width="140">'.$modCodeMember->name.'</td>'."\n";
print '<td>'.$modCodeMember->info($langs).'</td>'."\n";
print '<td class="nowrap">'.$modCodeMember->getExample($langs).'</td>'."\n";
print '<td class="nowrap">'.$modCodeMember->getExample().'</td>'."\n";

if (getDolGlobalString('MEMBER_CODEMEMBER_ADDON') == "$file") {
print '<td class="center">'."\n";
Expand Down Expand Up @@ -389,6 +391,7 @@

require_once $dir.'/'.$file;
$module = new $classname($db);
'@phan-var-force doc_generic_member_odt|pdf_standard_member $module';

$modulequalified = 1;
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
Expand Down
2 changes: 1 addition & 1 deletion htdocs/adherents/class/subscription.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ public function info($id)
* Return clickable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @param array $arraydata Array of data
* @param array{selected:?int,member:?Adherent,bank:?Account} $arraydata Array of data
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '', $arraydata = null)
Expand Down
2 changes: 2 additions & 0 deletions htdocs/adherents/tpl/linkedobjectblock.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
global $user;

$langs = $GLOBALS['langs'];
'@phan-var-force Translate $langs';
$linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
'@phan-var-force Subscription[] $linkedObjectBlock';
$langs->load("members");

$total = 0;
Expand Down
2 changes: 2 additions & 0 deletions htdocs/admin/agenda_other.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@
require_once $dir.'/'.$file;
$module = new $classname($db, new ActionComm($db));

'@phan-var-force ModeleAction $module';

print '<tr class="oddeven">'."\n";
print "<td>";
print(empty($module->name) ? $name : $module->name);
Expand Down
6 changes: 4 additions & 2 deletions htdocs/admin/bank.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,8 @@
require_once $dir.'/'.$file;
$module = new $classname($db);

'@phan-var-force ModeleBankAccountDoc $module';

$modulequalified = 1;
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
$modulequalified = 0;
Expand All @@ -359,7 +361,7 @@
print(empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) {
print $module->info($langs);
print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod
} else {
print $module->description;
}
Expand Down Expand Up @@ -468,7 +470,7 @@
print '<td colspan="4" width="180" class="nowrap">'.$langs->trans("BankColorizeMovementName".$key)."</td>";
// Color
print '<td class="nowrap right">';
print $formother->selectColor((GETPOST("BANK_COLORIZE_MOVEMENT_COLOR".$key) ? GETPOST("BANK_COLORIZE_MOVEMENT_COLOR".$key) : getDolGlobalString($color)), "BANK_COLORIZE_MOVEMENT_COLOR".$key, 'bankmovementcolorconfig', 1, '', 'right hideifnotset');
print $formother->selectColor((GETPOST("BANK_COLORIZE_MOVEMENT_COLOR".$key) ? GETPOST("BANK_COLORIZE_MOVEMENT_COLOR".$key) : getDolGlobalString($color)), "BANK_COLORIZE_MOVEMENT_COLOR".$key, 'bankmovementcolorconfig', 1, array(), 'right hideifnotset');
print '</td>';
print "</tr>";
$i++;
Expand Down
5 changes: 5 additions & 0 deletions htdocs/admin/barcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@
$classname = "mod".ucfirst($filebis);
$module = new $classname($db);

'@phan-var-force ModeleBarCode $module';

// Show modules according to features level
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
continue;
Expand Down Expand Up @@ -288,6 +290,9 @@
}

$modBarCode = new $file();

'@phan-var-force ModeleNumRefBarCode $modBarCode';

print '<tr class="oddeven">';
print '<td>'.(isset($modBarCode->name) ? $modBarCode->name : $modBarCode->nom)."</td><td>\n";
print $modBarCode->info($langs);
Expand Down
2 changes: 2 additions & 0 deletions htdocs/admin/bom.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@

$module = new $classname($db);

'@phan-var-force ModeleNumRefBoms $module';

// Show modules according to features level
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
continue;
Expand Down
6 changes: 5 additions & 1 deletion htdocs/admin/contract.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@
/** @var ModelNumRefContracts $module */
$module = new $file($db);

'@phan-var-force ModelNumRefContracts $module';

// Show modules according to features level
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
continue;
Expand Down Expand Up @@ -383,6 +385,8 @@
/** @var ModelePDFContract $module */
$module = new $classname($db);

'@phan-var-force ModelePDFContract $module';

$modulequalified = 1;
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
$modulequalified = 0;
Expand All @@ -396,7 +400,7 @@
print(empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) {
print $module->info($langs);
print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod
} else {
print $module->description;
}
Expand Down
6 changes: 5 additions & 1 deletion htdocs/admin/delivery.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@

$module = new $file();

'@phan-var-force ModeleNumRefDeliveryOrder $module';

if ($module->isEnabled()) {
// Show modules according to features level
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
Expand Down Expand Up @@ -392,6 +394,8 @@
require_once $dir.'/'.$file;
$module = new $classname($db);

'@phan-var-force ModelePDFDeliveryOrder $module';

$modulequalified = 1;
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
$modulequalified = 0;
Expand All @@ -405,7 +409,7 @@
print(empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) {
print $module->info($langs);
print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod
} else {
print $module->description;
}
Expand Down
4 changes: 4 additions & 0 deletions htdocs/admin/dolistore/class/dolistore.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ public function getRemoteCategories()
// Call
dol_syslog("Call API with opt = ".var_export($opt, true));
$xml = $this->api->get($opt);
// @phan-suppress-next-line PhanPluginUnknownObjectMethodCall
$this->categories = $xml->categories->children();
} catch (PrestaShopWebserviceException $e) {
// Here we are dealing with errors
Expand Down Expand Up @@ -185,6 +186,7 @@ public function getRemoteProducts($options = array('start' => 0, 'end' => 10, 'p
$xml = $this->api->get($opt2);

$products = array();
// @phan-suppress-next-line PhanPluginUnknownObjectMethodCall
foreach ($xml->products->children() as $product) {
$products[] = (int) $product['id'];
}
Expand All @@ -199,6 +201,7 @@ public function getRemoteProducts($options = array('start' => 0, 'end' => 10, 'p
$xml = $this->api->get($opt2);

$products = array();
// @phan-suppress-next-line PhanPluginUnknownObjectMethodCall
foreach ($xml->category->associations->products->children() as $product) {
$products[] = (int) $product->id;
}
Expand All @@ -213,6 +216,7 @@ public function getRemoteProducts($options = array('start' => 0, 'end' => 10, 'p
// Call API to get the detail
dol_syslog("Call API with opt = ".var_export($opt, true));
$xml = $this->api->get($opt);
// @phan-suppress-next-line PhanPluginUnknownObjectMethodCall
$this->products = $xml->products->children();
} catch (PrestaShopWebserviceException $e) {
// Here we are dealing with errors
Expand Down
1 change: 1 addition & 0 deletions htdocs/admin/emailcollector_card.php
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@
throw new Exception("Failed to refresh access token: ".$e->getMessage());
}

// @phan-suppress-next-line PhanPluginUnknownObjectMethodCall
$tokenobj->setRefreshToken($refreshtoken);
$storage->storeAccessToken($OAUTH_SERVICENAME, $tokenobj);
}
Expand Down
5 changes: 4 additions & 1 deletion htdocs/admin/expedition.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@
require_once $dir.$file.'.php';

$module = new $file();
'@phan-var-force ModelNumRefExpedition $module';

if ($module->isEnabled()) {
// Show modules according to features level
Expand Down Expand Up @@ -340,6 +341,8 @@
require_once $dir.'/'.$file;
$module = new $classname($db);

'@phan-var-force ModelePdfExpedition $module';

$modulequalified = 1;
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
$modulequalified = 0;
Expand All @@ -353,7 +356,7 @@
print(empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) {
print $module->info($langs);
print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod
} else {
print $module->description;
}
Expand Down
8 changes: 6 additions & 2 deletions htdocs/admin/expensereport.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@

$module = new $file($db);

'@phan-var-force ModeleNumRefExpenseReport $module';

// Show modules according to features level
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
continue;
Expand All @@ -237,7 +239,7 @@
}

if ($module->isEnabled()) {
print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
print '<tr class="oddeven"><td>'.$module->getName($langs)."</td><td>\n";
print $module->info($langs);
print '</td>';

Expand Down Expand Up @@ -359,6 +361,8 @@
require_once $dir.'/'.$file;
$module = new $classname($db);

'@phan-var-force ModeleExpenseReport $module';

$modulequalified = 1;
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
$modulequalified = 0;
Expand All @@ -372,7 +376,7 @@
print(empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) {
print $module->info($langs);
print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod
} else {
print $module->description;
}
Expand Down
3 changes: 2 additions & 1 deletion htdocs/admin/expensereport_rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright (C) 2017 ATM Consulting <[email protected]>
* Copyright (C) 2017 Pierre-Henry Favre <[email protected]>
* Copyright (C) 2018-2019 Frédéric 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 @@ -355,7 +356,7 @@
echo '</tr>';
}

if (count($rules) == 0) {
if (!is_array($rules) || count($rules) == 0) {
print '<tr class="none"><td colspan="8"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
}

Expand Down
8 changes: 6 additions & 2 deletions htdocs/admin/fichinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@

$module = new $file();

'@phan-var-force ModeleNumRefFicheinter $module';

if ($module->isEnabled()) {
// Show modules according to features level
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
Expand All @@ -305,7 +307,7 @@
}


print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
print '<tr class="oddeven"><td>'.$module->getName($langs)."</td><td>\n";
print $module->info($langs);
print '</td>';

Expand Down Expand Up @@ -432,6 +434,8 @@
require_once $dir.'/'.$file;
$module = new $classname($db);

'@phan-var-force ModelePDFFicheinter $module';

$modulequalified = 1;
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
$modulequalified = 0;
Expand All @@ -445,7 +449,7 @@
print(empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) {
print $module->info($langs);
print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod
} else {
print $module->description;
}
Expand Down
7 changes: 6 additions & 1 deletion htdocs/admin/holiday.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@

$module = new $file($db);

'@phan-var-force ModelNumRefHolidays $module';

// Show modules according to features level
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
continue;
Expand Down Expand Up @@ -345,6 +347,9 @@
require_once $dir.'/'.$file;
$module = new $classname($db);


'@phan-var-force ModelePDFHoliday $module';

$modulequalified = 1;
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
$modulequalified = 0;
Expand All @@ -358,7 +363,7 @@
print(empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) {
print $module->info($langs);
print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod
} else {
print $module->description;
}
Expand Down
Loading

0 comments on commit 75ed925

Please sign in to comment.