mirror of
https://github.com/rectorphp/rector.git
synced 2024-05-29 07:20:52 +00:00
55 lines
1.6 KiB
PHP
55 lines
1.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Rector\Tests\BetterPhpDocParser\PhpDocInfo\PhpDocInfoPrinter;
|
|
|
|
use Iterator;
|
|
use PhpParser\Comment\Doc;
|
|
use PhpParser\Node;
|
|
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
|
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
|
|
use Rector\BetterPhpDocParser\Printer\PhpDocInfoPrinter;
|
|
use Rector\Core\HttpKernel\RectorKernel;
|
|
use Symplify\EasyTesting\DataProvider\StaticFixtureFinder;
|
|
use Symplify\PackageBuilder\Testing\AbstractKernelTestCase;
|
|
use Symplify\SmartFileSystem\SmartFileSystem;
|
|
|
|
abstract class AbstractPhpDocInfoPrinterTest extends AbstractKernelTestCase
|
|
{
|
|
/**
|
|
* @var PhpDocInfoPrinter
|
|
*/
|
|
protected $phpDocInfoPrinter;
|
|
|
|
/**
|
|
* @var SmartFileSystem
|
|
*/
|
|
protected $smartFileSystem;
|
|
|
|
/**
|
|
* @var PhpDocInfoFactory
|
|
*/
|
|
private $phpDocInfoFactory;
|
|
|
|
protected function setUp(): void
|
|
{
|
|
$this->bootKernel(RectorKernel::class);
|
|
|
|
$this->phpDocInfoFactory = $this->getService(PhpDocInfoFactory::class);
|
|
$this->phpDocInfoPrinter = $this->getService(PhpDocInfoPrinter::class);
|
|
$this->smartFileSystem = $this->getService(SmartFileSystem::class);
|
|
}
|
|
|
|
protected function createPhpDocInfoFromDocCommentAndNode(string $docComment, Node $node): PhpDocInfo
|
|
{
|
|
$node->setDocComment(new Doc($docComment));
|
|
return $this->phpDocInfoFactory->createFromNodeOrEmpty($node);
|
|
}
|
|
|
|
protected function yieldFilesFromDirectory(string $directory, string $suffix = '*.php'): Iterator
|
|
{
|
|
return StaticFixtureFinder::yieldDirectory($directory, $suffix);
|
|
}
|
|
}
|