From 64480f2f2c95dfe827cda719d9537f5956889cd0 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 4 Jan 2025 10:13:35 +0100 Subject: [PATCH] add test fixture to skip resource --- .../Fixture/SkipCallable.php | 2 +- .../Fixture/SkipClosure.php | 2 +- .../Fixture/SkipResource.php | 33 +++++++++++++++++++ ...rrowPublicClassMethodParamTypeRuleTest.php | 1 + 4 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 tests/Rules/NarrowPublicClassMethodParamTypeRule/Fixture/SkipResource.php diff --git a/tests/Rules/NarrowPublicClassMethodParamTypeRule/Fixture/SkipCallable.php b/tests/Rules/NarrowPublicClassMethodParamTypeRule/Fixture/SkipCallable.php index b6449f51..716886cc 100644 --- a/tests/Rules/NarrowPublicClassMethodParamTypeRule/Fixture/SkipCallable.php +++ b/tests/Rules/NarrowPublicClassMethodParamTypeRule/Fixture/SkipCallable.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Rector\TypePerfect\Tests\Rules\ReturnNullOverFalseRule\Fixture; +namespace Rector\TypePerfect\Tests\Rules\NarrowPublicClassMethodParamTypeRule\Fixture; final class SkipCallable { diff --git a/tests/Rules/NarrowPublicClassMethodParamTypeRule/Fixture/SkipClosure.php b/tests/Rules/NarrowPublicClassMethodParamTypeRule/Fixture/SkipClosure.php index 47ddaaa4..f6e5182c 100644 --- a/tests/Rules/NarrowPublicClassMethodParamTypeRule/Fixture/SkipClosure.php +++ b/tests/Rules/NarrowPublicClassMethodParamTypeRule/Fixture/SkipClosure.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Rector\TypePerfect\Tests\Rules\ReturnNullOverFalseRule\Fixture; +namespace Rector\TypePerfect\Tests\Rules\NarrowPublicClassMethodParamTypeRule\Fixture; final class SkipClosure { diff --git a/tests/Rules/NarrowPublicClassMethodParamTypeRule/Fixture/SkipResource.php b/tests/Rules/NarrowPublicClassMethodParamTypeRule/Fixture/SkipResource.php new file mode 100644 index 00000000..f8acce67 --- /dev/null +++ b/tests/Rules/NarrowPublicClassMethodParamTypeRule/Fixture/SkipResource.php @@ -0,0 +1,33 @@ +map($resource, 'name'); + + + $resource = $this->getFileResource(); + $this->map($resource, 'surname'); + } + + /** + * @return resource + */ + private function getFileResource() + { + return fopen('file.txt', 'r'); + } +} diff --git a/tests/Rules/NarrowPublicClassMethodParamTypeRule/NarrowPublicClassMethodParamTypeRuleTest.php b/tests/Rules/NarrowPublicClassMethodParamTypeRule/NarrowPublicClassMethodParamTypeRuleTest.php index fa6295bb..a7affa7e 100644 --- a/tests/Rules/NarrowPublicClassMethodParamTypeRule/NarrowPublicClassMethodParamTypeRuleTest.php +++ b/tests/Rules/NarrowPublicClassMethodParamTypeRule/NarrowPublicClassMethodParamTypeRuleTest.php @@ -26,6 +26,7 @@ public function testRule(array $filePaths, array $expectedErrorsWithLines): void public static function provideData(): Iterator { + yield [[__DIR__ . '/Fixture/SkipResource.php'], []]; yield [[__DIR__ . '/Fixture/SkipDateTimeMix.php'], []]; yield [[__DIR__ . '/Fixture/SkipNonPublicClassMethod.php'], []];