diff --git a/.gitattributes b/.gitattributes index c0351e5..ff548a5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,6 +1,7 @@ /.docker export-ignore /.github export-ignore /tests export-ignore +/types export-ignore .gitattributes export-ignore .gitignore export-ignore docker-compose.ci.yml export-ignore diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index a9e98b9..c05aedb 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -26,4 +26,5 @@ We accept contributions via Pull Requests on [GitHub](https://github.com/stauden docker compose run --rm php8.3 composer install docker compose run --rm php8.3 vendor/bin/phpunit docker compose run --rm php8.3 vendor/bin/phpstan analyse --memory-limit=-1 +docker compose run --rm php8.3 vendor/bin/phpstan analyse --configuration=phpstan.types.neon.dist --memory-limit=-1 ``` diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index f7110d1..2e0e258 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -31,3 +31,7 @@ jobs: run: | docker compose -f docker-compose.yml -f docker-compose.ci.yml run --rm php${{ matrix.php }} \ vendor/bin/phpstan analyse --error-format=github --memory-limit=-1 + - name: Analyse types + run: | + docker compose -f docker-compose.yml -f docker-compose.ci.yml run --rm php${{ matrix.php }} \ + vendor/bin/phpstan analyse --configuration=phpstan.types.neon.dist --error-format=github --memory-limit=-1 diff --git a/composer.json b/composer.json index 613f565..4e876ff 100644 --- a/composer.json +++ b/composer.json @@ -18,8 +18,8 @@ }, "require-dev": { "barryvdh/laravel-ide-helper": "^3.0", + "larastan/larastan": "^2.9", "orchestra/testbench": "^9.0", - "phpstan/phpstan": "^1.12", "phpunit/phpunit": "^11.0" }, "autoload": { diff --git a/phpstan.types.neon.dist b/phpstan.types.neon.dist new file mode 100644 index 0000000..188838b --- /dev/null +++ b/phpstan.types.neon.dist @@ -0,0 +1,6 @@ +includes: + - ./vendor/larastan/larastan/extension.neon +parameters: + level: 9 + paths: + - types diff --git a/types/Models/Comment.php b/types/Models/Comment.php new file mode 100644 index 0000000..e0b373d --- /dev/null +++ b/types/Models/Comment.php @@ -0,0 +1,11 @@ +', + $comment->belongsToThrough(Country::class, [User::class, Post::class]) + ); +}