From 27fa84f88475729e9fac4378022c9b8c4b990f7a Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Mon, 21 Aug 2023 20:23:21 +0800 Subject: [PATCH 1/4] wip Signed-off-by: Mior Muhammad Zaki --- composer.json | 4 ++-- phpstan.neon.dist | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 761475b..b3e187d 100644 --- a/composer.json +++ b/composer.json @@ -29,8 +29,8 @@ "illuminate/filesystem": "^8.75" }, "require-dev": { - "nunomaduro/larastan": "^1.0.1", - "orchestra/testbench": "^6.22" + "orchestra/testbench": "^6.22", + "phpstan/phpstan": "^1.10.6" }, "conflict": { "orchestra/testbench-core": "<6.32.0" diff --git a/phpstan.neon.dist b/phpstan.neon.dist index dcaf9ec..4db19cb 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,6 +1,4 @@ includes: - - ./vendor/nunomaduro/larastan/extension.neon - parameters: paths: From 63a96f79e8cd3952e7717e23fee457be30d96e31 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Mon, 21 Aug 2023 20:24:48 +0800 Subject: [PATCH 2/4] wip Signed-off-by: Mior Muhammad Zaki --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index b3e187d..886cdd4 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ "illuminate/filesystem": "^8.75" }, "require-dev": { - "orchestra/testbench": "^6.22", + "orchestra/testbench": "^6.32", "phpstan/phpstan": "^1.10.6" }, "conflict": { From 486a3899a720508e1373bb88905687f4f60e34e9 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Mon, 21 Aug 2023 20:28:06 +0800 Subject: [PATCH 3/4] wip Signed-off-by: Mior Muhammad Zaki --- phpstan.neon.dist | 4 ++-- pint.json | 15 +++++++++++++++ src/Presets/Preset.php | 2 +- 3 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 pint.json diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 4db19cb..263d7ad 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -7,6 +7,6 @@ parameters: # The level 8 is the highest level level: 7 + checkGenericClassInNonGenericObjectType: false checkMissingIterableValueType: false - noUnnecessaryCollectionCall: false - checkModelProperties: false + treatPhpDocTypesAsCertain: false diff --git a/pint.json b/pint.json new file mode 100644 index 0000000..628bd22 --- /dev/null +++ b/pint.json @@ -0,0 +1,15 @@ +{ + "preset": "laravel", + "rules": { + "native_function_invocation": { + "include": ["@compiler_optimized"], + "scope": "namespaced", + "strict": true + }, + "no_superfluous_phpdoc_tags": false, + "php_unit_method_casing": false, + "nullable_type_declaration_for_default_null_value": { + "use_nullable_type_declaration": true + } + } +} diff --git a/src/Presets/Preset.php b/src/Presets/Preset.php index 8f976ac..ca5475c 100644 --- a/src/Presets/Preset.php +++ b/src/Presets/Preset.php @@ -53,7 +53,7 @@ public function is(string $name): bool * @param mixed|null $default * @return mixed */ - public function config(string $key = null, $default = null) + public function config(?string $key = null, $default = null) { if (\is_null($key)) { return $this->config; From 0bd49827edadc649411c803d2ddd7e824be53835 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Mon, 21 Aug 2023 20:31:08 +0800 Subject: [PATCH 4/4] wip Signed-off-by: Mior Muhammad Zaki --- phpstan-baseline.neon | 6 ++++++ phpstan.neon.dist | 2 ++ 2 files changed, 8 insertions(+) create mode 100644 phpstan-baseline.neon diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 0000000..d60fac4 --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,6 @@ +parameters: + ignoreErrors: + - + message: "#^Call to an undefined method Illuminate\\\\Contracts\\\\Container\\\\Container\\:\\:basePath\\(\\)\\.$#" + count: 1 + path: src/LaravelServiceProvider.php diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 263d7ad..bfd81a8 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,4 +1,6 @@ includes: + - ./phpstan-baseline.neon + parameters: paths: