Browse Source

Fix phpstan

Laurent Destailleur 1 year ago
parent
commit
2777857f5b
3 changed files with 9 additions and 5 deletions
  1. 1 1
      build/phpstan/README
  2. 4 4
      build/phpstan/bootstrap.php
  3. 4 0
      phpstan.neon

+ 1 - 1
build/phpstan/README

@@ -14,4 +14,4 @@ composer require --dev phpstan/phpstan
 
 Execute:
 cd git/dolibarr
-php8.2 ../phpstan/htdocs/includes/bin/phpstan -v analyze -a build/phpstan/bootstrap.php htdocs/commande/class -l0 --memory-limit 2G
+php8.2 ../phpstan/htdocs/includes/bin/phpstan -v analyze -a build/phpstan/bootstrap.php htdocs/commande/class -l0 --memory-limit 12G

+ 4 - 4
build/phpstan/bootstrap.php

@@ -1,10 +1,10 @@
 <?php
 // Defined some constants and load Dolibarr env to reduce PHPStan bootstrap that fails to load a lot of things.
-define('DOL_DOCUMENT_ROOT', __DIR__ . '/../../htdocs');
-define('DOL_DATA_ROOT', __DIR__ . '/../../documents');
-define('DOL_URL_ROOT', '/');
+//define('DOL_DOCUMENT_ROOT', __DIR__ . '/../../htdocs');
+//define('DOL_DATA_ROOT', __DIR__ . '/../../documents');
+//define('DOL_URL_ROOT', '/');
 
-// Load the main.inc.php file to have functions llx_Header and llx_Footer defined
+// Load the main.inc.php file to have functions env defined
 if (! defined("NOLOGIN")) define("NOLOGIN", '1');
 global $conf, $langs, $user, $db;
 include_once __DIR__ . '/../../htdocs/main.inc.php';

+ 4 - 0
phpstan.neon

@@ -4,10 +4,14 @@ parameters:
 		- php
 	excludePaths:
 		- 'htdocs/build/*'
+		- 'htdocs/custom/*'
 		- 'htdocs/dev/*'
+		- 'htdocs/doc/*'
+		- 'htdocs/documents/*'
 		- 'htdocs/includes/*'
 		- 'htdocs/install/doctemplates/*'
 		- 'htdocs/langs/*'
+		- 'htdocs/support/*'
 		- 'htdocs/test/*'
 	checkAlwaysTrueCheckTypeFunctionCall: false
 	checkAlwaysTrueInstanceof: false