From 0965a84929362a9b6ce8c6a89601a937e572a2ac Mon Sep 17 00:00:00 2001 From: Art4 <art4@wlabs.de> Date: Sat, 2 Nov 2024 22:24:10 +0100 Subject: [PATCH] install PHPStan for static code analysis --- .phpstan.neon | 9 ++++++++ composer.json | 2 ++ composer.lock | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 .phpstan.neon diff --git a/.phpstan.neon b/.phpstan.neon new file mode 100644 index 0000000000..d69bb2f99c --- /dev/null +++ b/.phpstan.neon @@ -0,0 +1,9 @@ +parameters: + level: 0 + + paths: + - src/ + + scanDirectories: + - mod + - vendor diff --git a/composer.json b/composer.json index 0280409716..706ee3f0e4 100644 --- a/composer.json +++ b/composer.json @@ -152,10 +152,12 @@ "mikey179/vfsstream": "^1.6", "mockery/mockery": "^1.3", "php-mock/php-mock-phpunit": "^2.10", + "phpstan/phpstan": "^1.12", "phpunit/phpunit": "^9" }, "scripts": { "test": "phpunit", + "phpstan": "phpstan analyze --memory-limit 1024M --configuration .phpstan.neon", "lint": "find . -name \\*.php -not -path './vendor/*' -not -path './view/asset/*' -print0 | xargs -0 -n1 php -l", "docker:translate": "docker run --rm -v $PWD:/data -w /data friendicaci/transifex bin/run_xgettext.sh", "cs:install": "@composer install --working-dir=bin/dev/php-cs-fixer", diff --git a/composer.lock b/composer.lock index fae42ffe16..7d1e831b14 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d51158b9593011921144e90af146a86a", + "content-hash": "11175d4e9806e8a5069d010140431af1", "packages": [ { "name": "asika/simple-console", @@ -4832,6 +4832,64 @@ ], "time": "2024-02-11T07:24:16+00:00" }, + { + "name": "phpstan/phpstan", + "version": "1.12.7", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "dc2b9976bd8b0f84ec9b0e50cc35378551de7af0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/dc2b9976bd8b0f84ec9b0e50cc35378551de7af0", + "reference": "dc2b9976bd8b0f84ec9b0e50cc35378551de7af0", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", + "issues": "https://github.com/phpstan/phpstan/issues", + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + } + ], + "time": "2024-10-18T11:12:07+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "9.2.31",