mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-19 14:27:14 +01:00
remove SplitLine value object
This commit is contained in:
parent
2291d5540a
commit
ce480d3983
@ -12,7 +12,6 @@ use Rector\Core\Contract\Rector\PhpRectorInterface;
|
||||
use Rector\Core\Exception\ShouldNotHappenException;
|
||||
use Rector\Core\Testing\Contract\RunnableInterface;
|
||||
use Rector\Core\Testing\PHPUnit\DataProvider\StaticFixtureUpdater;
|
||||
use Rector\Core\Testing\ValueObject\SplitLine;
|
||||
use Rector\Core\ValueObject\StaticNonPhpFileSuffixes;
|
||||
use Symplify\EasyTesting\StaticFixtureSplitter;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
@ -13,8 +13,11 @@ use Symplify\SmartFileSystem\SmartFileSystem;
|
||||
*/
|
||||
final class StaticFixtureUpdater
|
||||
{
|
||||
public static function updateFixtureContent(SmartFileInfo $originalFileInfo, string $changedContent, SmartFileInfo $fixtureFileInfo): void
|
||||
{
|
||||
public static function updateFixtureContent(
|
||||
SmartFileInfo $originalFileInfo,
|
||||
string $changedContent,
|
||||
SmartFileInfo $fixtureFileInfo
|
||||
): void {
|
||||
if (! getenv('UPDATE_TESTS') && ! getenv('UT')) {
|
||||
return;
|
||||
}
|
||||
@ -37,5 +40,4 @@ final class StaticFixtureUpdater
|
||||
{
|
||||
return new SmartFileSystem();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Testing\ValueObject;
|
||||
|
||||
final class SplitLine
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const REGEX = "#-----\r?\n#";
|
||||
}
|
@ -5,12 +5,13 @@ declare(strict_types=1);
|
||||
namespace Rector\Utils\ProjectValidator\Command;
|
||||
|
||||
use Nette\Utils\Strings;
|
||||
use Rector\Core\Testing\ValueObject\SplitLine;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
use Symplify\EasyTesting\StaticFixtureSplitter;
|
||||
use Symplify\EasyTesting\ValueObject\SplitLine;
|
||||
use Symplify\PackageBuilder\Console\Command\CommandNaming;
|
||||
use Symplify\PackageBuilder\Console\ShellCode;
|
||||
use Symplify\SmartFileSystem\Finder\FinderSanitizer;
|
||||
@ -87,13 +88,12 @@ final class ValidateFixtureContentCommand extends Command
|
||||
|
||||
private function hasFileIdenticalCodeBeforeAndAfter(SmartFileInfo $smartFileInfo): bool
|
||||
{
|
||||
$contents = $smartFileInfo->getContents();
|
||||
if (! Strings::match($contents, SplitLine::REGEX)) {
|
||||
if (! Strings::match($smartFileInfo->getContents(), SplitLine::SPLIT_LINE)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// original → expected
|
||||
[$originalContent, $expectedContent] = Strings::split($contents, SplitLine::REGEX);
|
||||
[$originalContent, $expectedContent] = StaticFixtureSplitter::splitFileInfoToInputAndExpected($smartFileInfo);
|
||||
|
||||
return $originalContent === $expectedContent;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user