From 012ced9fff8c6bd0df1e80e47784318fb3218f2b Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sun, 4 May 2025 22:21:17 +0200 Subject: [PATCH] [tests] Add test case for https://github.com/rectorphp/type-perfect/issues/59 --- .../Fixture/Generics/SkipPassedGenerics.php | 24 +++++++++++++++++++ ...rrowPublicClassMethodParamTypeRuleTest.php | 2 ++ 2 files changed, 26 insertions(+) create mode 100644 tests/Rules/NarrowPublicClassMethodParamTypeRule/Fixture/Generics/SkipPassedGenerics.php diff --git a/tests/Rules/NarrowPublicClassMethodParamTypeRule/Fixture/Generics/SkipPassedGenerics.php b/tests/Rules/NarrowPublicClassMethodParamTypeRule/Fixture/Generics/SkipPassedGenerics.php new file mode 100644 index 00000000..309ba5c5 --- /dev/null +++ b/tests/Rules/NarrowPublicClassMethodParamTypeRule/Fixture/Generics/SkipPassedGenerics.php @@ -0,0 +1,24 @@ + $g */ + public function doFoo(GenericA $g):void + { + } +} + +/** @param GenericA $g */ +function doFoo($g):void { + $user = new User(); + $user->doFoo($g); +} diff --git a/tests/Rules/NarrowPublicClassMethodParamTypeRule/NarrowPublicClassMethodParamTypeRuleTest.php b/tests/Rules/NarrowPublicClassMethodParamTypeRule/NarrowPublicClassMethodParamTypeRuleTest.php index 37709674..cbe2aab1 100644 --- a/tests/Rules/NarrowPublicClassMethodParamTypeRule/NarrowPublicClassMethodParamTypeRuleTest.php +++ b/tests/Rules/NarrowPublicClassMethodParamTypeRule/NarrowPublicClassMethodParamTypeRuleTest.php @@ -26,6 +26,8 @@ public function testRule(array $filePaths, array $expectedErrorsWithLines): void public static function provideData(): Iterator { + yield [[__DIR__ . '/Fixture/Generics/SkipPassedGenerics.php'], []]; + yield [[__DIR__ . '/Fixture/SkipDefault.php'], []]; yield [[__DIR__ . '/Fixture/SkipResource.php'], []]; yield [[__DIR__ . '/Fixture/SkipDateTimeMix.php'], []];