Test phpstan

This commit is contained in:
Laurent Destailleur 2023-08-04 02:57:10 +02:00
parent 76338116bf
commit 23b35492fd
3 changed files with 17 additions and 9 deletions

View File

@ -4,6 +4,14 @@ https://phpstan.org
PHPStan requires PHP >= 7.1
Install: composer require --dev phpstan/phpstan
Config File: phpstan.neon
Install:
cd git
mkdir phpstan
cd phpstan
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

View File

@ -1,9 +1,4 @@
<?php
// Example to use PHPStan
// cd git/dolibarr
// /usr/bin/php7.2 /pathtophpstan/phpstan.phar -l1 analyze htdocs/societe/website.php --memory-limit 2G
// /usr/bin/php7.2 /pathtophpstan/phpstan analyze htdocs/societe/website.php --memory-limit 2G
// 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');

View File

@ -2,6 +2,13 @@ parameters:
customRulesetUsed: true
fileExtensions:
- php
excludePaths:
- 'htdocs/build/*'
- 'htdocs/dev/*'
- 'htdocs/includes/*'
- 'htdocs/install/doctemplates/*'
- 'htdocs/langs/*'
- 'htdocs/test/*'
checkAlwaysTrueCheckTypeFunctionCall: false
checkAlwaysTrueInstanceof: false
checkAlwaysTrueStrictComparison: false
@ -37,12 +44,10 @@ parameters:
nodesByFileCountMax: 512
nodesByStringCountMax: 512
reportUnmatchedIgnoredErrors: true
scopeClass: PHPStan\Analyser\Scope
universalObjectCratesClasses:
- stdClass
- SimpleXMLElement
earlyTerminatingMethodCalls: []
memoryLimitFile: %tmpDir%/.memory_limit
dynamicConstantNames:
- ICONV_IMPL
- PHP_VERSION