Laurent Destailleur 697c8d14b7 Fix phpcs 1 year ago
..
README 3b252e50a3 fix: add /build/phpstan/phpstan/phpstan/vendor/bin and custom bootstrap.php in gitingnore and review README (#26679) 1 year ago
bootstrap.php 697c8d14b7 Fix phpcs 1 year ago

README

PHPStan (https://phpstan.org)
-----------------------------

PHPStan requires PHP >= 7.1

Config File is: ./phpstan.neon

In dolibarr/build/phpstan
mkdir phpstan
cd phpstan
composer require --dev phpstan/phpstan

Build report from CLI:
In dolibarr/
mv htdocs/custom /tmp/
php build/phpstan/phpstan/vendor/bin/phpstan -v analyze -c ./phpstan.neon -a build/phpstan/bootstrap.php --memory-limit 4G --error-format=table htdocs/commande/class
php build/phpstan/phpstan/vendor/bin/phpstan -v analyze -c ./phpstan.neon -a build/phpstan/bootstrap.php --memory-limit 4G --error-format=table htdocs/
mv /tmp/custom htdocs

Build HTML report from Cron:
Example of line to add into a cron to generate a HTML report:
0 1 5 * * cd /home/dolibarr/preview.dolibarr.org/dolibarr; chmod -R u+w /home/dolibarr/preview.dolibarr.org/dolibarr; git pull; /home/dolibarr/phpstan/vendor/bin/phpstan -v analyze -a build/phpstan/bootstrap.php --memory-limit 4G --error-format=github | awk ' BEGIN{ print "Date "strftime("%Y-%m-%d")"
" } { print $0"
" } END{ print NR } ' > /home/dolibarr/doxygen.dolibarr.org/phpstan/index.html