From b803552ca21dc2365f3845b322e7bd20dee1b3c5 Mon Sep 17 00:00:00 2001 From: Nino Treyssat-Vincent <18269685+treyssatvincent@users.noreply.github.com> Date: Thu, 21 Dec 2023 13:20:35 +0100 Subject: [PATCH 1/2] chore: run phpstan & php-cs-fixer on CI --- .github/workflows/run-tests.yml | 35 +++++++++++++++++++++++++++++++++ composer.json | 1 + phpstan.neon | 4 ++++ 3 files changed, 40 insertions(+) create mode 100644 phpstan.neon diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 5a172f3..a57e792 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -3,6 +3,41 @@ name: run-tests on: [push, pull_request] jobs: + quality-tools: + runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + php: [ 8.3 ] + laravel: [ 10.* ] + dependency-version: [ prefer-stable ] + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: ~/.composer/cache/files + key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, mysql, mysqli, pdo_mysql + coverage: none + + - name: Install dependencies + run: | + composer install --prefer-dist --no-interaction --no-suggest + + - name: Execute php-cs-fixer + run: vendor/bin/php-cs-fixer fix --dry-run --diff + + - name: Execute phpstan + run: vendor/bin/phpstan + test: runs-on: ubuntu-latest strategy: diff --git a/composer.json b/composer.json index 5819f13..148d3f8 100755 --- a/composer.json +++ b/composer.json @@ -22,6 +22,7 @@ "require-dev": { "friendsofphp/php-cs-fixer": "^3.41", "orchestra/testbench": "^8.18 || ^v7.38", + "phpstan/phpstan": "^1.10", "phpunit/phpunit": "^10.1 || ^9.6" }, "autoload": { diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..16f0d34 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,4 @@ +parameters: + paths: + - src + level: max From 24c575118fdba4c6fbbbb559736b850d3fb98ae6 Mon Sep 17 00:00:00 2001 From: Nino Treyssat-Vincent <18269685+treyssatvincent@users.noreply.github.com> Date: Thu, 21 Dec 2023 13:20:35 +0100 Subject: [PATCH 2/2] tech: add strict_types in exception --- src/MissingNextcloudUsernameException.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/MissingNextcloudUsernameException.php b/src/MissingNextcloudUsernameException.php index de5f5fa..d9c2974 100644 --- a/src/MissingNextcloudUsernameException.php +++ b/src/MissingNextcloudUsernameException.php @@ -1,5 +1,7 @@