From d36746ede8047bb04e62f5240e944dbe77641cff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karim=20Cassam=20Chena=C3=AF?= Date: Sat, 13 Apr 2024 13:41:36 +0200 Subject: [PATCH 1/3] add phpstan and correct till level 5 --- composer.json | 2 ++ phpstan.neon | 18 ++++++++++++++++++ .../Exception/LocalesNotDefinedException.php | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 phpstan.neon diff --git a/composer.json b/composer.json index 47221a93..23929455 100644 --- a/composer.json +++ b/composer.json @@ -36,6 +36,7 @@ "illuminate/support": "^8.0 || ^9.0 || ^10.0 || ^11.0" }, "require-dev": { + "larastan/larastan": "^2.0", "laravel/legacy-factories": "^1.0.4", "laravel/pint": "^1.0", "mockery/mockery": "^1.3.3", @@ -66,6 +67,7 @@ }, "scripts": { "fix": "@php vendor/bin/pint", + "phpstan": "@php vendor/bin/phpstan analyse", "test": "@php vendor/bin/phpunit", "test-coverage": "@php vendor/bin/phpunit --coverage-html=build" } diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 00000000..95608f0e --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,18 @@ +includes: + - vendor/larastan/larastan/extension.neon + +parameters: + + paths: + - src/ + + # Level 9 is the highest level + level: 6 + +# ignoreErrors: +# - '#PHPDoc tag @var#' +# +# excludePaths: +# - ./*/*/FileToBeExcluded.php +# +# checkMissingIterableValueType: false diff --git a/src/Translatable/Exception/LocalesNotDefinedException.php b/src/Translatable/Exception/LocalesNotDefinedException.php index 13dbdb6d..6d2dfc0f 100644 --- a/src/Translatable/Exception/LocalesNotDefinedException.php +++ b/src/Translatable/Exception/LocalesNotDefinedException.php @@ -6,6 +6,6 @@ class LocalesNotDefinedException extends \Exception { public static function make(): self { - return new static('Please make sure you have run `php artisan vendor:publish --provider="Astrotomic\Translatable\TranslatableServiceProvider"` and that the locales configuration is defined.'); + return new self('Please make sure you have run `php artisan vendor:publish --provider="Astrotomic\Translatable\TranslatableServiceProvider"` and that the locales configuration is defined.'); } } From 87ea0913ce94dfb2e5d63e69f7cbf6446df201bc Mon Sep 17 00:00:00 2001 From: Tom Witkowski Date: Wed, 17 Apr 2024 13:51:35 +0200 Subject: [PATCH 2/3] fix CI --- .github/workflows/phpunit.yml | 8 +------- README.md | 4 ++-- composer.json | 8 ++++---- docs/README.md | 4 ++-- 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index cbf79688..6caeb386 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -14,12 +14,10 @@ jobs: fail-fast: false matrix: php: [8.0, 8.1, 8.2, 8.3] - laravel: [8.*, 9.*, 10.*, 11.*] + laravel: [9.*, 10.*, 11.*] dependency-version: [prefer-stable] os: [ubuntu-latest] include: - - laravel: '8.*' - phpunit: '9.*' - laravel: '9.*' phpunit: '9.*' - laravel: '10.*' @@ -31,10 +29,6 @@ jobs: laravel: '10.*' - php: '8.0' laravel: '11.*' - - php: '8.2' - laravel: '8.*' - - php: '8.3' - laravel: '8.*' - php: '8.3' laravel: '9.*' - php: '8.1' diff --git a/README.md b/README.md index 1f44fe2b..11d9c279 100644 --- a/README.md +++ b/README.md @@ -97,8 +97,8 @@ If you discover any security related issues, please check [SECURITY](https://git ## Versions | Package | Laravel | PHP | -| :------------------ | :---------------------------- | :-------- | -| **v11.13 - v11.13** | `8.* / 9.* / 10.*` / `11.*` | `^8.0` | +| :------------------ |:------------------------------| :-------- | +| **v11.13 - v11.13** | `9.* / 10.* / 11.*` | `^8.0` | | **v11.12 - v11.12** | `8.* / 9.* / 10.*` | `^8.0` | | **v11.10 - v11.11** | `8.* / 9.*` | `^8.0` | | **v11.6 - v11.9** | `5.8.* / 6.* / 7.* / 8.*` | `>=7.2` | diff --git a/composer.json b/composer.json index 23929455..4b185612 100644 --- a/composer.json +++ b/composer.json @@ -31,16 +31,16 @@ }, "require": { "php": "^8.0", - "illuminate/contracts": "^8.0 || ^9.0 || ^10.0 || ^11.0", - "illuminate/database": "^8.0 || ^9.0 || ^10.0 || ^11.0", - "illuminate/support": "^8.0 || ^9.0 || ^10.0 || ^11.0" + "illuminate/contracts": "^9.0 || ^10.0 || ^11.0", + "illuminate/database": "^9.0 || ^10.0 || ^11.0", + "illuminate/support": "^9.0 || ^10.0 || ^11.0" }, "require-dev": { "larastan/larastan": "^2.0", "laravel/legacy-factories": "^1.0.4", "laravel/pint": "^1.0", "mockery/mockery": "^1.3.3", - "orchestra/testbench": "^6.0 || ^7.0 || ^8.0 || ^9.0", + "orchestra/testbench": "^7.0 || ^8.0 || ^9.0", "phpunit/phpunit": "^10.0" }, "minimum-stability": "dev", diff --git a/docs/README.md b/docs/README.md index 7fd44ebd..21c045e1 100644 --- a/docs/README.md +++ b/docs/README.md @@ -74,8 +74,8 @@ echo $post->translate('fr')->title; // Mon premier post ## Versions | Package | Laravel | PHP | -| :------------------ | :---------------------------- | :-------- | -| **v11.13 - v11.13** | `8.* / 9.* / 10.*` / `11.*` | `^8.0` | +| :------------------ |:------------------------------| :-------- | +| **v11.13 - v11.13** | `9.* / 10.* / 11.*` | `^8.0` | | **v11.12 - v11.12** | `8.* / 9.* / 10.*` | `^8.0` | | **v11.10 - v11.11** | `8.* / 9.*` | `^8.0` | | **v11.6 - v11.9** | `5.8.* / 6.* / 7.* / 8.*` | `>=7.2` | From cd5ba705066200c3ee4fd9f2e8d3d3e76247ba6b Mon Sep 17 00:00:00 2001 From: Gummibeer Date: Wed, 17 Apr 2024 11:51:57 +0000 Subject: [PATCH 3/3] Prettified Code! --- README.md | 2 +- docs/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 11d9c279..6b04000e 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ If you discover any security related issues, please check [SECURITY](https://git ## Versions | Package | Laravel | PHP | -| :------------------ |:------------------------------| :-------- | +| :------------------ | :---------------------------- | :-------- | | **v11.13 - v11.13** | `9.* / 10.* / 11.*` | `^8.0` | | **v11.12 - v11.12** | `8.* / 9.* / 10.*` | `^8.0` | | **v11.10 - v11.11** | `8.* / 9.*` | `^8.0` | diff --git a/docs/README.md b/docs/README.md index 21c045e1..124a834f 100644 --- a/docs/README.md +++ b/docs/README.md @@ -74,7 +74,7 @@ echo $post->translate('fr')->title; // Mon premier post ## Versions | Package | Laravel | PHP | -| :------------------ |:------------------------------| :-------- | +| :------------------ | :---------------------------- | :-------- | | **v11.13 - v11.13** | `9.* / 10.* / 11.*` | `^8.0` | | **v11.12 - v11.12** | `8.* / 9.* / 10.*` | `^8.0` | | **v11.10 - v11.11** | `8.* / 9.*` | `^8.0` |