mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-24 19:53:14 +01:00
fix preg_match made array type [closes #786]
Signed-off-by: Tomas Votruba <tomas.vot@gmail.com>
This commit is contained in:
parent
231ac15879
commit
5d421585fd
21
fixturize.php
Normal file
21
fixturize.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
|
use Nette\Utils\FileSystem;
|
||||||
|
use Nette\Utils\Strings;
|
||||||
|
use Symfony\Component\Finder\Finder;
|
||||||
|
use Symfony\Component\Finder\SplFileInfo;
|
||||||
|
|
||||||
|
require __DIR__ . '/vendor/autoload.php';
|
||||||
|
|
||||||
|
// 1. rename files
|
||||||
|
$finder = (new Finder())->files()
|
||||||
|
->in([__DIR__ . '/packages', __DIR__ . '/tests'])
|
||||||
|
->name('#(wrong|Wrong)#');
|
||||||
|
|
||||||
|
/** @var SplFileInfo $fileInfo */
|
||||||
|
foreach ($finder as $fileInfo) {
|
||||||
|
$newName = Strings::replace($fileInfo->getRealPath(), '#wrong#', 'fixture');
|
||||||
|
FileSystem::rename($fileInfo->getRealPath(), $newName);
|
||||||
|
// remove old file
|
||||||
|
unlink($fileInfo->getRealPath());
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user