From 27a118c6f3fa9a744d605960270c2072a4ab2ec6 Mon Sep 17 00:00:00 2001 From: Michael Bolli Date: Mon, 6 Jan 2025 08:34:40 +0100 Subject: [PATCH 1/3] Create SkipExplicitlyNullableParams.php --- .../Fixture/SkipExplicitlyNullableParams.php | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/Rules/NarrowPublicClassMethodParamTypeRule/Fixture/SkipExplicitlyNullableParams.php diff --git a/tests/Rules/NarrowPublicClassMethodParamTypeRule/Fixture/SkipExplicitlyNullableParams.php b/tests/Rules/NarrowPublicClassMethodParamTypeRule/Fixture/SkipExplicitlyNullableParams.php new file mode 100644 index 00000000..5b7e0f5a --- /dev/null +++ b/tests/Rules/NarrowPublicClassMethodParamTypeRule/Fixture/SkipExplicitlyNullableParams.php @@ -0,0 +1,21 @@ +test(false); + } +} From 0e7fa97a684a0020151ff93d8b250b6cef2d8a11 Mon Sep 17 00:00:00 2001 From: Michael Bolli Date: Mon, 6 Jan 2025 08:42:20 +0100 Subject: [PATCH 2/3] add optional second param --- .../Fixture/SkipExplicitlyNullableParams.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/Rules/NarrowPublicClassMethodParamTypeRule/Fixture/SkipExplicitlyNullableParams.php b/tests/Rules/NarrowPublicClassMethodParamTypeRule/Fixture/SkipExplicitlyNullableParams.php index 5b7e0f5a..a50aff1e 100644 --- a/tests/Rules/NarrowPublicClassMethodParamTypeRule/Fixture/SkipExplicitlyNullableParams.php +++ b/tests/Rules/NarrowPublicClassMethodParamTypeRule/Fixture/SkipExplicitlyNullableParams.php @@ -8,6 +8,7 @@ final class SkipExplicitlyNullableParams { public function test( ?bool $bool = true, + array $array = [], ): bool { return $bool; From ab7f1f10e194d4d7a269b59e6022dbded4beb4ef Mon Sep 17 00:00:00 2001 From: Michael Bolli Date: Mon, 6 Jan 2025 11:35:06 +0100 Subject: [PATCH 3/3] Update NarrowPublicClassMethodParamTypeRuleTest.php --- .../NarrowPublicClassMethodParamTypeRuleTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/Rules/NarrowPublicClassMethodParamTypeRule/NarrowPublicClassMethodParamTypeRuleTest.php b/tests/Rules/NarrowPublicClassMethodParamTypeRule/NarrowPublicClassMethodParamTypeRuleTest.php index a7affa7e..9f1ab2e0 100644 --- a/tests/Rules/NarrowPublicClassMethodParamTypeRule/NarrowPublicClassMethodParamTypeRuleTest.php +++ b/tests/Rules/NarrowPublicClassMethodParamTypeRule/NarrowPublicClassMethodParamTypeRuleTest.php @@ -163,6 +163,10 @@ public static function provideData(): Iterator yield [[ __DIR__ . '/Fixture/HandleDefaultValue.php', ], [[$argErrorMessage, 15]]]; + + yield [[ + __DIR__ . '/Fixture/SkipExplicitlyNullableParams.php', + ], []]; } /**