From 6d9c0483a6efdedef60759e12b4e245cd5ef5cb0 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Mon, 21 Aug 2023 09:39:55 +0100 Subject: [PATCH] chore: improves type checking --- composer.json | 4 ++-- phpstan.neon | 9 +++++++++ src/Factories/Attributes/Attribute.php | 2 +- src/Factories/TestCaseFactory.php | 2 +- src/KernelDump.php | 2 +- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 5e9cb34c..c1c4ca8b 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "nunomaduro/collision": "^7.8.1", "nunomaduro/termwind": "^1.15.1", "pestphp/pest-plugin": "^2.0.1", - "pestphp/pest-plugin-arch": "^2.2.3", + "pestphp/pest-plugin-arch": "^2.3.1", "phpunit/phpunit": "^10.3.2" }, "conflict": { @@ -50,7 +50,7 @@ ] }, "require-dev": { - "pestphp/pest-dev-tools": "^2.15.0", + "pestphp/pest-dev-tools": "^2.16.0", "pestphp/pest-plugin-type-coverage": "^2.0.0", "symfony/process": "^6.3.2" }, diff --git a/phpstan.neon b/phpstan.neon index 9ed48871..1cd3a087 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,6 @@ includes: - vendor/phpstan/phpstan-strict-rules/rules.neon + - vendor/ergebnis/phpstan-rules/rules.neon - vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon parameters: @@ -11,4 +12,12 @@ parameters: reportUnmatchedIgnoredErrors: true ignoreErrors: + - "#has a nullable return type declaration.#" + - "#Language construct isset\\(\\) should not be used.#" + - "#is not allowed to extend#" + - "#is concrete, but does not have a Test suffix#" + - "#with a nullable type declaration#" - "#type mixed is not subtype of native#" + - "# with null as default value#" + - "#has parameter \\$closure with default value.#" + - "#has parameter \\$description with default value.#" diff --git a/src/Factories/Attributes/Attribute.php b/src/Factories/Attributes/Attribute.php index 21df216d..e8af0e77 100644 --- a/src/Factories/Attributes/Attribute.php +++ b/src/Factories/Attributes/Attribute.php @@ -20,7 +20,7 @@ abstract class Attribute * @param array $attributes * @return array */ - public function __invoke(TestCaseMethodFactory $method, array $attributes): array + public function __invoke(TestCaseMethodFactory $method, array $attributes): array // @phpstan-ignore-line { return $attributes; } diff --git a/src/Factories/TestCaseFactory.php b/src/Factories/TestCaseFactory.php index 98ccb3aa..cbe50985 100644 --- a/src/Factories/TestCaseFactory.php +++ b/src/Factories/TestCaseFactory.php @@ -193,7 +193,7 @@ final class TestCaseFactory } PHP; - eval($classCode); + eval($classCode); // @phpstan-ignore-line } catch (ParseError $caught) { throw new RuntimeException(sprintf( "Unable to create test case for test file at %s. \n %s", diff --git a/src/KernelDump.php b/src/KernelDump.php index 6e1833ca..39f2004b 100644 --- a/src/KernelDump.php +++ b/src/KernelDump.php @@ -40,7 +40,7 @@ final class KernelDump */ public function disable(): void { - @ob_clean(); + @ob_clean(); // @phpstan-ignore-line if ($this->buffer !== '') { $this->flush();