2025-01-05 14:28:07 +01:00
|
|
|
PHPStan (https://phpstan.org)
|
2023-08-06 11:56:31 +02:00
|
|
|
-----------------------------
|
2021-05-02 19:28:58 +02:00
|
|
|
|
|
|
|
|
PHPStan requires PHP >= 7.1
|
|
|
|
|
|
2023-08-06 11:56:31 +02:00
|
|
|
Config File is: ./phpstan.neon
|
2023-08-04 02:57:10 +02:00
|
|
|
|
2024-01-14 13:14:52 +01:00
|
|
|
= Installation =
|
|
|
|
|
|
2025-01-05 14:46:26 +01:00
|
|
|
cd ./dev/build/phpstan
|
2023-11-18 15:11:40 +01:00
|
|
|
mkdir phpstan
|
2023-08-04 02:57:10 +02:00
|
|
|
cd phpstan
|
|
|
|
|
composer require --dev phpstan/phpstan
|
|
|
|
|
|
2024-01-14 13:14:52 +01:00
|
|
|
|
|
|
|
|
= Build report from CLI =
|
|
|
|
|
|
2023-11-18 15:11:40 +01:00
|
|
|
In dolibarr/
|
|
|
|
|
mv htdocs/custom /tmp/
|
2025-01-05 14:46:26 +01:00
|
|
|
php dev/build/phpstan/phpstan/vendor/bin/phpstan -v analyze -c ./phpstan.neon -a dev/build/phpstan/bootstrap.php --memory-limit 4G --error-format=table htdocs/commande/class
|
|
|
|
|
php dev/build/phpstan/phpstan/vendor/bin/phpstan -v analyze -c ./phpstan.neon -a dev/build/phpstan/bootstrap.php --memory-limit 4G --error-format=table htdocs/
|
2023-08-04 03:42:46 +02:00
|
|
|
mv /tmp/custom htdocs
|
2023-08-06 11:56:31 +02:00
|
|
|
|
|
|
|
|
Build HTML report from Cron:
|
|
|
|
|
Example of line to add into a cron to generate a HTML report:
|
2025-01-05 16:30:56 +01:00
|
|
|
0 1 5 * * cd /home/dolibarr/preview.dolibarr.org/dolibarr; chmod -R u+w /home/dolibarr/preview.dolibarr.org/dolibarr; git reset --hard HEAD; git pull; /home/dolibarr/preview.dolibarr.org/dolibarr/dev/build/phpstan/vendor/bin/phpstan -v analyze --memory-limit 4G --error-format=github | awk ' BEGIN{ print "Date "strftime("%Y-%m-%d")"<br>" } { print $0"<br>" } END{ print NR } ' > /home/dolibarr/cti.dolibarr.org/phpstanindex.html
|