diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index ee9cde2603f..0bb240128f8 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -228,14 +228,58 @@ return [ 'simplify_ast' => true, 'analyzed_file_extensions' => ['php','inc'], 'globals_type_map' => [ + 'action' => 'string', + 'actioncode' => 'string', + 'badgeStatus0' => 'string', + 'badgeStatus1' => 'string', + 'badgeStatus11' => 'string', + 'badgeStatus3' => 'string', + 'badgeStatus4' => 'string', + 'badgeStatus6' => 'string', + 'badgeStatus8' => 'string', + 'badgeStatus9' => 'string', + 'classname' => 'string', 'conf' => '\Conf', + 'conffile' => 'string', + 'conffiletoshow' => 'string', + 'conffiletoshowshort' => 'string', + 'dateSelector' => 'int<0,1>', 'db' => '\DoliDB', + 'disableedit' => 'int<0,1>', + 'disablemove' => 'int<0,1>', + 'disableremove' => 'int<0,1>', + 'dolibarr_main_authentication' => 'string', + 'dolibarr_main_data_root' => 'string', + 'dolibarr_main_data_root' => 'string', + 'dolibarr_main_db_encrypted_pass' => 'string', + 'dolibarr_main_db_host' => 'string', + 'dolibarr_main_db_pass' => 'string', + 'dolibarr_main_demo' => 'string', + 'dolibarr_main_document_root' => 'string', + 'dolibarr_main_url_root' => 'string', + 'errormsg' => 'string', 'extrafields' => '\ExtraFields', + 'filter' => 'string', + 'filtert' => 'int', + 'forceall' => 'int<0,1>', + 'form' => '\Form', 'hookmanager' => '\HookManager', + 'inputalsopricewithtax' => 'int<0,1>', 'langs' => '\Translate', + 'leftmenu' => 'string', + 'mainmenu' => 'string', + 'menumanager' => 'string', 'mysoc' => '\Societe', 'nblines' => '\int', + 'obj' => '\CommonObject', // Deprecated + 'object_rights' => 'int|stdClass', + 'objectoffield' => '\CommonObject', + 'senderissupplier' => 'int<0,1,2>', 'user' => '\User', + 'website' => '\WebSite', + 'websitepage' => '\WebSitePage', + 'websitepagefile' => 'string', + // 'object' => '\CommonObject', // Deprecated, not enabled because conflicts with $object assignments ], // Supported values: `'5.6'`, `'7.0'`, `'7.1'`, `'7.2'`, `'7.3'`, `'7.4'`, `null`. @@ -284,6 +328,7 @@ return [ .'|htdocs/includes/restler/.*' // @phpstan-ignore-line // Included as stub (did not seem properly analysed by phan without it) .'|htdocs/includes/stripe/.*' // @phpstan-ignore-line + .'|htdocs/conf/conf.php' // @phpstan-ignore-line // .'|htdocs/[^h].*/.*' // For testing @phpstan-ignore-line .')@', // @phpstan-ignore-line @@ -297,7 +342,7 @@ return [ // Alternately, you can pass in the full path to a PHP file // with the plugin's implementation (e.g. 'vendor/phan/phan/.phan/plugins/AlwaysReturnPlugin.php') 'ParamMatchRegexPlugin' => [ - '/^GETPOST$/' => [1, $sanitizeRegex], + '/^GETPOST$/' => [1, $sanitizeRegex, 'GetPostUnknownSanitizeType'], '/^isModEnabled$/' => [0, $moduleNameRegex, 'UnknownModuleName'], // Note: trick to have different key for same regex: '/^isModEnable[d]$/' => [0, $deprecatedModuleNameRegex, "DeprecatedModuleName"], diff --git a/dev/tools/phan/config_extended.php b/dev/tools/phan/config_extended.php index 65dcc8f7389..7db2b587708 100644 --- a/dev/tools/phan/config_extended.php +++ b/dev/tools/phan/config_extended.php @@ -206,6 +206,26 @@ return [ 'mysoc' => '\Societe', 'nblines' => '\int', 'user' => '\User', + 'dolibarr_main_data_root' => 'string', + 'dolibarr_main_authentication' => 'string', + 'dolibarr_main_demo' => 'string', + 'menumanager' => 'string', + 'errormsg' => 'string', + 'form' => '\Form', + 'object_rights' => 'int|stdClass', + 'disableedit' => 'int<0,1>', + 'disablemove' => 'int<0,1>', + 'disableremove' => 'int<0,1>', + // Found in dol_eval + 'website' => '\WebSite', + 'websitepage' => '\WebSitePage', + 'websitepagefile' => 'string', + 'action' => 'string', + 'mainmenu' => 'string', + 'leftmenu' => 'string', + 'objectoffield' => '\CommonObject', + // 'object' => '\CommonObject', // Deprecated, not enabled because conflicts with $object assignments + 'obj' => '\CommonObject', // Deprecated ], // Supported values: `'5.6'`, `'7.0'`, `'7.1'`, `'7.2'`, `'7.3'`, `'7.4'`, `null`. @@ -254,6 +274,7 @@ return [ .'|htdocs/includes/restler/.*' // @phpstan-ignore-line // Included as stub (did not seem properly analysed by phan without it) .'|htdocs/includes/stripe/.*' // @phpstan-ignore-line + .'|htdocs/conf/conf.php' // @phpstan-ignore-line .')@', // @phpstan-ignore-line // A list of plugin files to execute. @@ -266,11 +287,11 @@ return [ // Alternately, you can pass in the full path to a PHP file // with the plugin's implementation (e.g. 'vendor/phan/phan/.phan/plugins/AlwaysReturnPlugin.php') 'ParamMatchRegexPlugin' => [ - '/^GETPOST$/' => [1, $sanitizeRegex], + '/^GETPOST$/' => [1, $sanitizeRegex, 'GetPostUnknownSanitizeType'], '/^isModEnabled$/' => [0, $moduleNameRegex, 'UnknownModuleName'], // Note: trick to have different key for same regex: '/^isModEnable[d]$/' => [0, $deprecatedModuleNameRegex, "DeprecatedModuleName"], - '/^sanitizeVal$/' => [1, $sanitizeRegex], + '/^sanitizeVal$/' => [1, $sanitizeRegex,"UnknownSanitizeType"], ], 'plugins' => [ __DIR__.'/plugins/NoVarDumpPlugin.php', diff --git a/dev/tools/phan/config_fixer.php b/dev/tools/phan/config_fixer.php index 18e50834844..a588483e3bf 100644 --- a/dev/tools/phan/config_fixer.php +++ b/dev/tools/phan/config_fixer.php @@ -103,6 +103,7 @@ return [ .'|htdocs/includes/restler/.*' // @phpstan-ignore-line // Included as stub (did not seem properly analysed by phan without it) .'|htdocs/includes/stripe/.*' // @phpstan-ignore-line + .'|htdocs/conf/conf.php' // @phpstan-ignore-line //.'|htdocs/[^c][^o][^r][^e][^/].*' // For testing @phpstan-ignore-line //.'|htdocs/[^h].*' // For testing on restricted set @phpstan-ignore-line .')@', // @phpstan-ignore-line