From c12bcf7b5a79ac88dfbce683d63aecb803bbab2c Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Sat, 15 Feb 2025 20:14:44 +0100 Subject: [PATCH] chore: :wrench: update to work with phpstan --- .gitea/workflows/app_template.yml | 2 +- Makefile | 44 ++++++------------------------- composer.json | 10 +++---- package.json | 2 +- phpstan.neon | 6 +++++ psalm.xml | 21 --------------- 6 files changed, 21 insertions(+), 64 deletions(-) create mode 100644 phpstan.neon delete mode 100644 psalm.xml diff --git a/.gitea/workflows/app_template.yml b/.gitea/workflows/app_template.yml index 927773e..1258307 100644 --- a/.gitea/workflows/app_template.yml +++ b/.gitea/workflows/app_template.yml @@ -24,7 +24,7 @@ jobs: - run: composer install - run: composer run lint - run: composer run cs:check - - run: composer run psalm + - run: composer run phpstan nodejs: runs-on: ubuntu-latest diff --git a/Makefile b/Makefile index c6d23db..520493b 100644 --- a/Makefile +++ b/Makefile @@ -84,42 +84,14 @@ appstore: rm -rf $(appstore_build_directory) mkdir -p $(appstore_build_directory) tar -C .. -cvzf $(appstore_package_name).tar.gz \ - --exclude="$(app_name)/build" \ - --exclude="$(app_name)/tests" \ - --exclude="$(app_name)/Makefile" \ - --exclude="$(app_name)/*.log" \ - --exclude="$(app_name)/phpunit*xml" \ - --exclude="$(app_name)/composer.*" \ - --exclude="$(app_name)/node_modules" \ - --exclude="$(app_name)/js/node_modules" \ - --exclude="$(app_name)/js/tests" \ - --exclude="$(app_name)/js/test" \ - --exclude="$(app_name)/js/*.log" \ - --exclude="$(app_name)/js/package.json" \ - --exclude="$(app_name)/js/bower.json" \ - --exclude="$(app_name)/js/karma.*" \ - --exclude="$(app_name)/js/protractor.*" \ - --exclude="$(app_name)/package.json" \ - --exclude="$(app_name)/bower.json" \ - --exclude="$(app_name)/karma.*" \ - --exclude="$(app_name)/protractor\.*" \ - --exclude="$(app_name)/.*" \ - --exclude="$(app_name)/js/.*" \ - --exclude="$(app_name)/tsconfig.json" \ - --exclude="$(app_name)/stylelint.config.cjs" \ - --exclude="$(app_name)/README.md" \ - --exclude="$(app_name)/package-lock.json" \ - --exclude="$(app_name)/LICENSE" \ - --exclude="$(app_name)/src" \ - --exclude="$(app_name)/stubs" \ - --exclude="$(app_name)/screens" \ - --exclude="$(app_name)/vendor" \ - --exclude="$(app_name)/translationfiles" \ - --exclude="$(app_name)/Dockerfile" \ - --exclude="$(app_name)/psalm.xml" \ - --exclude="$(app_name)/renovate.json" \ - --exclude="$(app_name)/vite.config.ts" \ - $(app_name) + $(app_name)/appinfo \ + $(app_name)/css \ + $(app_name)/img \ + $(app_name)/js \ + $(app_name)/l10n \ + $(app_name)/lib \ + $(app_name)/templates \ + $(app_name)/CHANGELOG.md # Start a nextcloud server on Docker to kickstart developement .PHONY: dev diff --git a/composer.json b/composer.json index 70b95bf..4de6aff 100644 --- a/composer.json +++ b/composer.json @@ -18,25 +18,25 @@ "lint": "find . -name \\*.php -not -path './vendor/*' -not -path './vendor-bin/*' -not -path './build/*' -print0 | xargs -0 -n1 php -l", "cs:check": "php-cs-fixer fix --dry-run --diff", "cs:fix": "php-cs-fixer fix", - "psalm": "psalm --threads=1 --no-cache --show-info=true", + "phpstan": "phpstan clear-result-cache && phpstan analyse -c phpstan.neon", "rector": "rector && composer cs:fix" }, "require": { - "php": "~8.1.17" + "php": "^8.1" }, "require-dev": { "nextcloud/ocp": "^30.0.6", "roave/security-advisories": "dev-latest", "nextcloud/coding-standard": "^1.3.2", "nextcloud/rector": "^0.3.1", - "rector/rector": "~1.2.10", - "vimeo/psalm": "^6.5.1" + "phpstan/phpstan": "~1.12.18", + "rector/rector": "~1.2.10" }, "config": { "optimize-autoloader": true, "sort-packages": true, "platform": { - "php": "8.1.17" + "php": "8.1" } } } diff --git a/package.json b/package.json index edeb45a..3abb9f9 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "eslint-config-prettier": "^10.0.1", "eslint-plugin-prettier": "^5.2.3", "typescript": "~5.5.4", - "vue-tsc": "^2.2.0" + "vue-tsc": "^2.2.2" }, "prettier": "@nextcloud/prettier-config" } diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..550c70d --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,6 @@ +parameters: + level: 9 + paths: + - lib + ignoreErrors: + - '#Method [a-zA-Z0-9:\(\)\\_]+ return type with generic class OCP\\AppFramework\\Http\\[a-zA-Z]+ does not specify its types#' diff --git a/psalm.xml b/psalm.xml deleted file mode 100644 index 09d70a8..0000000 --- a/psalm.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - -