diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml new file mode 100644 index 00000000..77560afd --- /dev/null +++ b/.github/workflows/phpstan.yml @@ -0,0 +1,26 @@ +name: PHPStan + +on: + push: + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Validate composer.json and composer.lock + run: composer validate + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v2 + with: + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- + - name: Install dependencies + if: steps.composer-cache.outputs.cache-hit != 'true' + run: composer install --prefer-dist --no-progress --no-suggest + - name: Run phpstan + run: composer run-script phpstan diff --git a/.gitignore b/.gitignore index a4c3ecb8..259446a0 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,6 @@ test.html # vim *.swp + +# Composer +/vendor/ diff --git a/composer.json b/composer.json new file mode 100644 index 00000000..119e8c2e --- /dev/null +++ b/composer.json @@ -0,0 +1,19 @@ +{ + "name": "pi-hole/adminlte", + "type": "project", + "description": "Pi-hole Dashboard for stats and more", + "require": { + "php": ">=5.4", + "phpstan/phpstan": "^0.12.42" + }, + "license": "EUPL-1.2", + "minimum-stability": "stable", + "autoload": { + "files": [ + "scripts/vendor/qrcode.php" + ] + }, + "scripts": { + "phpstan": "vendor/phpstan/phpstan/phpstan analyse -c phpstan.neon.dist" + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 00000000..bf03a77c --- /dev/null +++ b/composer.lock @@ -0,0 +1,81 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "ba7e1b2ae29157ca9224ed7c390d5b78", + "packages": [ + { + "name": "phpstan/phpstan", + "version": "0.12.58", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "2a4847df6047b30af28854ed9dc95304cdb56ae5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/2a4847df6047b30af28854ed9dc95304cdb56ae5", + "reference": "2a4847df6047b30af28854ed9dc95304cdb56ae5", + "shasum": "" + }, + "require": { + "php": "^7.1|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.12-dev" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "support": { + "issues": "https://github.com/phpstan/phpstan/issues", + "source": "https://github.com/phpstan/phpstan/tree/0.12.58" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://www.patreon.com/phpstan", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", + "type": "tidelift" + } + ], + "time": "2020-11-29T13:32:03+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.4" + }, + "platform-dev": [], + "plugin-api-version": "2.0.0" +} diff --git a/phpstan.neon.dist b/phpstan.neon.dist new file mode 100644 index 00000000..63d89285 --- /dev/null +++ b/phpstan.neon.dist @@ -0,0 +1,8 @@ +parameters: + level: 0 + excludes_analyse: + - vendor + scanDirectories: + - . + paths: + - .