diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml
new file mode 100644
index 0000000..391c193
--- /dev/null
+++ b/.github/workflows/phpstan.yml
@@ -0,0 +1,28 @@
+name: PHPStan
+
+on:
+ push:
+ paths:
+ - '**.php'
+ - 'phpstan.neon.dist'
+
+jobs:
+ phpstan:
+ name: phpstan
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Setup PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: '8.2'
+ extensions: dom, curl, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv
+ coverage: none
+
+ - name: Install dependencies
+ run: |
+ composer update --no-interaction --prefer-dist
+
+ - name: Run PHPStan
+ run: ./vendor/bin/phpstan
diff --git a/.github/workflows/laravel.yml b/.github/workflows/run-tests.yml
similarity index 94%
rename from .github/workflows/laravel.yml
rename to .github/workflows/run-tests.yml
index 4d2aa68..cca4487 100644
--- a/.github/workflows/laravel.yml
+++ b/.github/workflows/run-tests.yml
@@ -1,4 +1,4 @@
-name: Laravel
+name: run-tests
on:
push:
@@ -20,11 +20,11 @@ jobs:
- laravel: 10.*
testbench: 8.*
- laravel: 11.*
- testbench: 9.*
+ testbench: 9.*
exclude:
- laravel: 11.*
php: 8.1
-
+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}
steps:
@@ -42,6 +42,6 @@ jobs:
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "symfony/console:>=4.3.4" "mockery/mockery:^1.3.2" "nesbot/carbon:>=2.62.1" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
-
+
- name: Execute tests
run: vendor/bin/phpunit
diff --git a/composer.json b/composer.json
index 24a8cc5..b270c6f 100644
--- a/composer.json
+++ b/composer.json
@@ -22,7 +22,8 @@
},
"require-dev": {
"orchestra/testbench": "^6.0|^7.0|^8.0|^9.0",
- "phpunit/phpunit": "^9.4|^10.1"
+ "phpunit/phpunit": "^9.4|^10.1",
+ "larastan/larastan": "^2.7"
},
"autoload": {
"files": [
@@ -38,6 +39,7 @@
}
},
"scripts": {
+ "analyse": "vendor/bin/phpstan analyse",
"test": "vendor/bin/phpunit"
},
"config": {
diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon
new file mode 100644
index 0000000..508e07d
--- /dev/null
+++ b/phpstan-baseline.neon
@@ -0,0 +1,17 @@
+parameters:
+ ignoreErrors:
+
+ -
+ message: "#^Call to an undefined static method Appstract\\\\Options\\\\Option\\:\\:where\\(\\)\\.$#"
+ count: 3
+ path: src/Option.php
+
+ -
+ message: "#^Call to an undefined static method Appstract\\\\Options\\\\Option\\:\\:updateOrCreate\\(\\)\\.$#"
+ count: 1
+ path: src/Option.php
+
+ -
+ message: "#^Call to an undefined static method Appstract\\\\Options\\\\OptionFacade\\:\\:set\\(\\)\\.$#"
+ count: 1
+ path: src/Console/OptionSetCommand.php
diff --git a/phpstan.neon.dist b/phpstan.neon.dist
new file mode 100644
index 0000000..6777b3c
--- /dev/null
+++ b/phpstan.neon.dist
@@ -0,0 +1,14 @@
+includes:
+ - phpstan-baseline.neon
+
+parameters:
+ level: 5
+ paths:
+ - src
+ - database
+ tmpDir: build/phpstan
+ checkMissingIterableValueType: true
+ reportUnmatchedIgnoredErrors: false
+
+ ignoreErrors:
+ - '#Unsafe usage of new static#'
diff --git a/phpunit.xml b/phpunit.xml.dist
similarity index 91%
rename from phpunit.xml
rename to phpunit.xml.dist
index 7f1ac1f..b13aaac 100644
--- a/phpunit.xml
+++ b/phpunit.xml.dist
@@ -5,12 +5,12 @@
tests
-