2
0
forked from Wavyzz/dolibarr

QUAL Use phan to help detect new issues (#27706)

* Qual: Add phan flow

- Add phan configuration (config, baseline, stubs);
- Add github action;
- Update apstats.php.

* Add directives to ignore false phan notices

* Qual: Add typing hints for extrafields TPL files

# Qual: Add typing hints for extrafields TPL files

Add typing hints for phan on view files

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
MDW
2024-02-21 18:14:29 +01:00
committed by GitHub
parent 5460b97e8b
commit 8655d5a86b
96 changed files with 29903 additions and 2 deletions

View File

@@ -1575,6 +1575,7 @@ function dol_string_nospecial($str, $newstr = '_', $badcharstoreplace = '', $bad
$forbidden_chars_to_remove = $badcharstoremove;
}
// @phan-suppress-next-line PhanPluginSuspiciousParamOrderInternal
return str_replace($forbidden_chars_to_replace, $newstr, str_replace($forbidden_chars_to_remove, "", $str));
}
@@ -1953,6 +1954,7 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename =
if (!empty($message)) {
// Test log level
// @phan-suppress-next-line PhanPluginDuplicateArrayKey
$logLevels = array(LOG_EMERG => 'EMERG', LOG_ALERT => 'ALERT', LOG_CRIT => 'CRITICAL', LOG_ERR => 'ERR', LOG_WARNING => 'WARN', LOG_NOTICE => 'NOTICE', LOG_INFO => 'INFO', LOG_DEBUG => 'DEBUG');
if (!array_key_exists($level, $logLevels)) {
throw new Exception('Incorrect log level');
@@ -6491,6 +6493,7 @@ function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round
}*/
$ret = price($dimension, 0, $outputlangs, 0, 0, $round);
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
$ret .= ' '.measuringUnitString(0, $type, $unit, $use_short_label, $outputlangs);
return $ret;
@@ -7785,6 +7788,7 @@ function dol_htmlwithnojs($stringtoencode, $nouseofiframesandbox = 0, $check = '
if (LIBXML_VERSION < 20900) {
// Avoid load of external entities (security problem).
// Required only if LIBXML_VERSION < 20900
// @phan-suppress-next-line PhanDeprecatedFunctionInternal
libxml_disable_entity_loader(true);
}
@@ -10628,6 +10632,7 @@ function dolExplodeIntoArray($string, $delimiter = ';', $kv = '=')
$newdelimiter = $delimiter;
} else {
// This is a simple string
// @phan-suppress-next-line PhanPluginSuspiciousParamPositionInternal
$newdelimiter = preg_quote($delimiter, '/');
}