mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-18 05:48:21 +01:00
Add self call fixtures for AssertResourceToClosed (#4103)
This commit is contained in:
parent
83e2db04d8
commit
471e820d4e
@ -6,6 +6,7 @@ namespace Rector\PHPUnit\Rector\MethodCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\MethodCall;
|
||||
use PhpParser\Node\Expr\StaticCall;
|
||||
use Rector\Core\PhpParser\Node\Manipulator\IdentifierManipulator;
|
||||
use Rector\Core\Rector\AbstractPHPUnitRector;
|
||||
use Rector\Core\RectorDefinition\CodeSample;
|
||||
@ -53,11 +54,11 @@ final class AssertResourceToClosedResourceRector extends AbstractPHPUnitRector
|
||||
*/
|
||||
public function getNodeTypes(): array
|
||||
{
|
||||
return [MethodCall::class];
|
||||
return [MethodCall::class, StaticCall::class];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param MethodCall $node
|
||||
* @param MethodCall|StaticCall $node
|
||||
*/
|
||||
public function refactor(Node $node): ?Node
|
||||
{
|
||||
|
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\PHPUnit\Tests\Rector\MethodCall\AssertResourceToClosedResourceRector\Fixture;
|
||||
|
||||
final class MyIsTypeTest2 extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function test()
|
||||
{
|
||||
$handler = fopen('php://temp', 'w');
|
||||
self::assertIsResource($handler);
|
||||
|
||||
fclose($handler);
|
||||
self::assertIsNotResource($handler);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\PHPUnit\Tests\Rector\MethodCall\AssertResourceToClosedResourceRector\Fixture;
|
||||
|
||||
final class MyIsTypeTest2 extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function test()
|
||||
{
|
||||
$handler = fopen('php://temp', 'w');
|
||||
self::assertIsResource($handler);
|
||||
|
||||
fclose($handler);
|
||||
self::assertIsClosedResource($handler);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user