From ad1348e0735661f3e90630acfbc938d2e0138e70 Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 10 Mar 2024 02:36:23 +0100 Subject: [PATCH 1/9] Fix phpstan workflow file # Fix phpstan workflow file Line was split in two, joined --- .github/workflows/phpstan.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 967d16ab04ea2..c6d3ed2a17e57 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -9,8 +9,7 @@ concurrency: cancel-in-progress: true env: - CACHE_KEY_PART: ${{ github.event_name == 'pull_request' && format('{0}-{1}', -github.base_ref, github.head_ref) || github.ref_name }} + CACHE_KEY_PART: ${{ github.event_name == 'pull_request' && format('{0}-{1}', github.base_ref, github.head_ref) || github.ref_name }} GITHUB_JSON: ${{ toJSON(github) }} # Helps in debugging Github Action # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: From c1dead563b763df64f2b28651eaab57dcd74bec3 Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 10 Mar 2024 02:51:02 +0100 Subject: [PATCH 2/9] qual: set memory limit to 'unlimited' (-1) --- .github/workflows/phpstan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index c6d3ed2a17e57..b67db2d0d3762 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -56,7 +56,7 @@ jobs: # Run PHPStan - name: Run PHPStan id: phpstan - run: phpstan -vvv analyse --error-format=checkstyle --memory-limit 4G -a build/phpstan/bootstrap_action.php -c phpstan.neon | tee _stan.xml | cs2pr --graceful-warnings + run: phpstan -vvv analyse --error-format=checkstyle --memory-limit 7G -a build/phpstan/bootstrap_action.php -c phpstan.neon | tee _stan.xml | cs2pr --graceful-warnings # continue-on-error: true # Save cache From 1c4901d052cd8ee7dd862aab7f76cfdcb9df1002 Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 10 Mar 2024 03:11:32 +0100 Subject: [PATCH 3/9] Remove some stubs to check impact --- phpstan.neon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index 8951e8ddaa2a6..e427a8a3459a5 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -16,8 +16,8 @@ parameters: stubFiles: # - dev/tools/phan/stubs/GeoIP2.php # - dev/tools/phan/stubs/geoip_inc.php - - dev/tools/phan/stubs/module_numberwords.php - - dev/tools/phan/stubs/restler.php + # - dev/tools/phan/stubs/module_numberwords.php + # - dev/tools/phan/stubs/restler.php - dev/tools/phan/stubs/stripe.php - dev/tools/phan/stubs/swiss-qr-bill.php excludePaths: From a999c7f3dbcf9e6426205f3a737a748e7e4fae2a Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 10 Mar 2024 03:20:49 +0100 Subject: [PATCH 4/9] Fix: Verify execution time limit --- .github/workflows/phpstan.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index b67db2d0d3762..1773e4146ffa3 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -56,7 +56,9 @@ jobs: # Run PHPStan - name: Run PHPStan id: phpstan - run: phpstan -vvv analyse --error-format=checkstyle --memory-limit 7G -a build/phpstan/bootstrap_action.php -c phpstan.neon | tee _stan.xml | cs2pr --graceful-warnings + run: | + php -i | grep max_execution_time + phpstan -vvv analyse --error-format=checkstyle --memory-limit 7G -a build/phpstan/bootstrap_action.php -c phpstan.neon | tee _stan.xml | cs2pr --graceful-warnings # continue-on-error: true # Save cache From b9b34aef0cb2e36c7b83ca51616fc033642ddf79 Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 10 Mar 2024 03:32:58 +0100 Subject: [PATCH 5/9] Remove stub files to reuse cache --- phpstan.neon | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index e427a8a3459a5..d521015a57fe9 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -13,13 +13,13 @@ parameters: paths: - htdocs - scripts - stubFiles: + # stubFiles: # - dev/tools/phan/stubs/GeoIP2.php # - dev/tools/phan/stubs/geoip_inc.php # - dev/tools/phan/stubs/module_numberwords.php # - dev/tools/phan/stubs/restler.php - - dev/tools/phan/stubs/stripe.php - - dev/tools/phan/stubs/swiss-qr-bill.php + # - dev/tools/phan/stubs/stripe.php + # - dev/tools/phan/stubs/swiss-qr-bill.php excludePaths: analyseAndScan: - htdocs/custom/* From d41e9b74617b9585651745f8d15e37df49b22749 Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 10 Mar 2024 11:44:05 +0100 Subject: [PATCH 6/9] Qual: Rename distribution phpstan.neon to phpstan.neon.dist # Qual: Rename distribution phpstan.neon to phpstan.neon.dist This allows the developer to override some settings locally Also update the .gitignore file with phpstan.neon and some other other ignores (cache, local log files, temporary edit files). --- .github/workflows/phpstan.yml | 2 +- .gitignore | 18 ++++++++++++++++-- phpstan.neon => phpstan.neon.dist | 0 3 files changed, 17 insertions(+), 3 deletions(-) rename phpstan.neon => phpstan.neon.dist (100%) diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 1773e4146ffa3..d9fcf8a3408ad 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -58,7 +58,7 @@ jobs: id: phpstan run: | php -i | grep max_execution_time - phpstan -vvv analyse --error-format=checkstyle --memory-limit 7G -a build/phpstan/bootstrap_action.php -c phpstan.neon | tee _stan.xml | cs2pr --graceful-warnings + phpstan -vvv analyse --error-format=checkstyle --memory-limit 7G -a build/phpstan/bootstrap_action.php -c phpstan.neon.dist | tee _stan.xml | cs2pr --graceful-warnings # continue-on-error: true # Save cache diff --git a/.gitignore b/.gitignore index efe6c66dfc01e..2964b1ead0f0a 100644 --- a/.gitignore +++ b/.gitignore @@ -66,8 +66,21 @@ doc/install.lock /composer.json /composer.lock -# to execute pre-commit -local.sh +# Local script, executed during pre-commit +/local.sh + +# Local phpstan configuration +/phpstan.neon +/phpstan-baseline.neon + +# Logs +/*.log + +# Vim swap files +*.sw? + +# Generated by PHPUNIT.BAT +/INI_PHPUNIT # ignore cache builds /build/phpstan/phpstan @@ -75,3 +88,4 @@ local.sh phpstan_custom.neon /.php-cs-fixer.cache /.php_cs.cache +/.cache diff --git a/phpstan.neon b/phpstan.neon.dist similarity index 100% rename from phpstan.neon rename to phpstan.neon.dist From 943d942d9d7d8a931dcf407c24fe2b342513eb92 Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 10 Mar 2024 11:52:51 +0100 Subject: [PATCH 7/9] Enable debug on phpstan --- .github/workflows/phpstan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index d9fcf8a3408ad..53d4a161e5baa 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -58,7 +58,7 @@ jobs: id: phpstan run: | php -i | grep max_execution_time - phpstan -vvv analyse --error-format=checkstyle --memory-limit 7G -a build/phpstan/bootstrap_action.php -c phpstan.neon.dist | tee _stan.xml | cs2pr --graceful-warnings + phpstan --debug -vvv analyse --error-format=checkstyle --memory-limit 7G -a build/phpstan/bootstrap_action.php -c phpstan.neon.dist | tee _stan.xml | cs2pr --graceful-warnings # continue-on-error: true # Save cache From 10f0982272d0d156f819bcd867b22394c07f5c05 Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 10 Mar 2024 11:53:46 +0100 Subject: [PATCH 8/9] Re-enable stubs --- phpstan.neon.dist | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index d521015a57fe9..7f82dc3c9c23f 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -16,10 +16,10 @@ parameters: # stubFiles: # - dev/tools/phan/stubs/GeoIP2.php # - dev/tools/phan/stubs/geoip_inc.php - # - dev/tools/phan/stubs/module_numberwords.php - # - dev/tools/phan/stubs/restler.php - # - dev/tools/phan/stubs/stripe.php - # - dev/tools/phan/stubs/swiss-qr-bill.php + - dev/tools/phan/stubs/module_numberwords.php + - dev/tools/phan/stubs/restler.php + - dev/tools/phan/stubs/stripe.php + - dev/tools/phan/stubs/swiss-qr-bill.php excludePaths: analyseAndScan: - htdocs/custom/* From 7db8dab5357f3fd83b108ea489e0ca3a2ccc196a Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 10 Mar 2024 12:26:53 +0100 Subject: [PATCH 9/9] Fix: Change parallel settings to defaults, remove buffer 'buffer' is not a documented parameter, removing it. Removing some configuration settings as the defaults are higher and should adapt better to the target machine --- .github/workflows/phpstan.yml | 3 +-- phpstan.neon.dist | 17 ++++++----------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 53d4a161e5baa..cbe0f4b273219 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -57,8 +57,7 @@ jobs: - name: Run PHPStan id: phpstan run: | - php -i | grep max_execution_time - phpstan --debug -vvv analyse --error-format=checkstyle --memory-limit 7G -a build/phpstan/bootstrap_action.php -c phpstan.neon.dist | tee _stan.xml | cs2pr --graceful-warnings + phpstan -vvv analyse --error-format=checkstyle --memory-limit 7G -a build/phpstan/bootstrap_action.php | tee _stan.xml | cs2pr --graceful-warnings # continue-on-error: true # Save cache diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 7f82dc3c9c23f..78867274e3027 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,11 +1,13 @@ parameters: tmpDir: ./.github/tmp parallel: - jobSize: 8 + # Commented some of the settings, reminding the defaults: + # should adapt better to target machines + # jobSize: 8 # default is 20 processTimeout: 600.0 - maximumNumberOfProcesses: 20 - minimumNumberOfJobsPerProcess: 2 - buffer: 134217728 # 128 MB + # maximumNumberOfProcesses: 20 # default is 32 + # minimumNumberOfJobsPerProcess: 2 # default is 2 + # buffer: 134217728 # 128 MB # Not documented customRulesetUsed: true level: 2 fileExtensions: @@ -13,13 +15,6 @@ parameters: paths: - htdocs - scripts - # stubFiles: - # - dev/tools/phan/stubs/GeoIP2.php - # - dev/tools/phan/stubs/geoip_inc.php - - dev/tools/phan/stubs/module_numberwords.php - - dev/tools/phan/stubs/restler.php - - dev/tools/phan/stubs/stripe.php - - dev/tools/phan/stubs/swiss-qr-bill.php excludePaths: analyseAndScan: - htdocs/custom/*