Skip to content

Commit

Permalink
add test fixture to skip resource (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba authored Jan 4, 2025
1 parent 9e6a241 commit dc19a23
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

declare(strict_types=1);

namespace Rector\TypePerfect\Tests\Rules\NarrowPublicClassMethodParamTypeRule\Fixture;

final class SkipResource
{
/**
* @param resource $resource
*/
public function map($resource, string $name): void
{
}

public function run()
{
$resource = @fsockopen('100', 100);
$this->map($resource, 'name');


$resource = $this->getFileResource();
$this->map($resource, 'surname');
}

/**
* @return resource
*/
private function getFileResource()
{
return fopen('file.txt', 'r');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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'], []];

Expand Down

0 comments on commit dc19a23

Please sign in to comment.