Updated Rector to commit a7e6b685e9

a7e6b685e9 [DX] Remove XmlFileFormatter, as Rector does not handle it (#2375)
This commit is contained in:
Tomas Votruba 2022-05-27 15:32:46 +00:00
parent 3179389e09
commit dde87d99cf
20 changed files with 43 additions and 210 deletions

View File

@ -5,10 +5,8 @@ namespace Rector\FileFormatter\Contract\Formatter;
use Rector\Core\ValueObject\Application\File;
use Rector\FileFormatter\ValueObject\EditorConfigConfiguration;
use Rector\FileFormatter\ValueObjectFactory\EditorConfigConfigurationBuilder;
interface FileFormatterInterface
{
public function supports(\Rector\Core\ValueObject\Application\File $file) : bool;
public function format(\Rector\Core\ValueObject\Application\File $file, \Rector\FileFormatter\ValueObject\EditorConfigConfiguration $editorConfigConfiguration) : void;
public function createDefaultEditorConfigConfigurationBuilder() : \Rector\FileFormatter\ValueObjectFactory\EditorConfigConfigurationBuilder;
}

View File

@ -53,7 +53,7 @@ final class FileFormatter
if (!$fileFormatter->supports($file)) {
continue;
}
$editorConfigConfigurationBuilder = $fileFormatter->createDefaultEditorConfigConfigurationBuilder();
$editorConfigConfigurationBuilder = new \Rector\FileFormatter\ValueObjectFactory\EditorConfigConfigurationBuilder();
$this->sniffOriginalFileContent($file, $editorConfigConfigurationBuilder);
$editorConfiguration = $this->createEditorConfiguration($file, $editorConfigConfigurationBuilder);
$fileFormatter->format($file, $editorConfiguration);

View File

@ -7,8 +7,6 @@ use RectorPrefix20220527\Ergebnis\Json\Printer\PrinterInterface;
use Rector\Core\ValueObject\Application\File;
use Rector\FileFormatter\Contract\Formatter\FileFormatterInterface;
use Rector\FileFormatter\ValueObject\EditorConfigConfiguration;
use Rector\FileFormatter\ValueObject\Indent;
use Rector\FileFormatter\ValueObjectFactory\EditorConfigConfigurationBuilder;
/**
* @see \Rector\Tests\FileFormatter\Formatter\JsonFileFormatter\JsonFileFormatterTest
*/
@ -34,10 +32,4 @@ final class JsonFileFormatter implements \Rector\FileFormatter\Contract\Formatte
$newFileContent .= $editorConfigConfiguration->getFinalNewline();
$file->changeFileContent($newFileContent);
}
public function createDefaultEditorConfigConfigurationBuilder() : \Rector\FileFormatter\ValueObjectFactory\EditorConfigConfigurationBuilder
{
$editorConfigConfigurationBuilder = new \Rector\FileFormatter\ValueObjectFactory\EditorConfigConfigurationBuilder();
$editorConfigConfigurationBuilder->withIndent(\Rector\FileFormatter\ValueObject\Indent::createSpaceWithSize(4));
return $editorConfigConfigurationBuilder;
}
}

View File

@ -1,140 +0,0 @@
<?php
declare (strict_types=1);
namespace Rector\FileFormatter\Formatter;
use RectorPrefix20220527\Nette\Utils\Strings;
use Rector\Core\Util\StringUtils;
use Rector\Core\ValueObject\Application\File;
use Rector\FileFormatter\Contract\Formatter\FileFormatterInterface;
use Rector\FileFormatter\ValueObject\EditorConfigConfiguration;
use Rector\FileFormatter\ValueObject\Indent;
use Rector\FileFormatter\ValueObjectFactory\EditorConfigConfigurationBuilder;
/**
* @see \Rector\Tests\FileFormatter\Formatter\XmlFileFormatter\XmlFileFormatterTest
*/
final class XmlFileFormatter implements \Rector\FileFormatter\Contract\Formatter\FileFormatterInterface
{
/**
* @see https://regex101.com/r/uTmMcr/1
* @var string
*/
private const XML_PARTS_REGEX = '#(>)(<)(\\/*)#';
/**
* @see https://regex101.com/r/hSG1JT/1
* @var string
*/
private const IS_OPENING_TAG_REGEX = '#^<[^\\/]*>$#';
/**
* @see https://regex101.com/r/ywS62K/1
* @var string
*/
private const IS_CLOSING_TAG_REGEX = '#^\\s*<\\/#';
/**
* @var int
*/
private $depth = 0;
/**
* @var int
*/
private $indent = 4;
/**
* @var string
*/
private $padChar = ' ';
/**
* @var bool
*/
private $preserveWhitespace = \false;
public function supports(\Rector\Core\ValueObject\Application\File $file) : bool
{
$smartFileInfo = $file->getSmartFileInfo();
return $smartFileInfo->getExtension() === 'xml';
}
public function format(\Rector\Core\ValueObject\Application\File $file, \Rector\FileFormatter\ValueObject\EditorConfigConfiguration $editorConfigConfiguration) : void
{
$this->padChar = $editorConfigConfiguration->getIndentStyleCharacter();
$this->indent = $editorConfigConfiguration->getIndentSize();
$newFileContent = $this->formatXml($file->getFileContent(), $editorConfigConfiguration);
$newFileContent .= $editorConfigConfiguration->getFinalNewline();
$file->changeFileContent($newFileContent);
}
public function createDefaultEditorConfigConfigurationBuilder() : \Rector\FileFormatter\ValueObjectFactory\EditorConfigConfigurationBuilder
{
$editorConfigConfigurationBuilder = new \Rector\FileFormatter\ValueObjectFactory\EditorConfigConfigurationBuilder();
$editorConfigConfigurationBuilder->withIndent(\Rector\FileFormatter\ValueObject\Indent::createTab());
return $editorConfigConfigurationBuilder;
}
private function formatXml(string $xml, \Rector\FileFormatter\ValueObject\EditorConfigConfiguration $editorConfigConfiguration) : string
{
$output = '';
$this->depth = 0;
$parts = $this->getXmlParts($xml);
if (\strncmp($parts[0], '<?xml', \strlen('<?xml')) === 0) {
$output = \array_shift($parts) . $editorConfigConfiguration->getNewLine();
}
foreach ($parts as $part) {
$output .= $this->getOutputForPart($part, $editorConfigConfiguration);
}
return \trim($output);
}
/**
* @return string[]
*/
private function getXmlParts(string $xml) : array
{
$withNewLines = \RectorPrefix20220527\Nette\Utils\Strings::replace(\trim($xml), self::XML_PARTS_REGEX, "\$1\n\$2\$3");
return \explode("\n", $withNewLines);
}
private function getOutputForPart(string $part, \Rector\FileFormatter\ValueObject\EditorConfigConfiguration $editorConfigConfiguration) : string
{
$output = '';
$this->runPre($part);
if ($this->preserveWhitespace) {
$output .= $part . $editorConfigConfiguration->getNewLine();
} else {
$part = \trim($part);
$output .= $this->getPaddedString($part) . $editorConfigConfiguration->getNewLine();
}
$this->runPost($part);
return $output;
}
private function runPre(string $part) : void
{
if ($this->isClosingTag($part)) {
--$this->depth;
}
}
private function runPost(string $part) : void
{
if ($this->isOpeningTag($part)) {
++$this->depth;
}
if ($this->isClosingCdataTag($part)) {
$this->preserveWhitespace = \false;
}
if ($this->isOpeningCdataTag($part)) {
$this->preserveWhitespace = \true;
}
}
private function getPaddedString(string $part) : string
{
return \str_pad($part, \strlen($part) + $this->depth * $this->indent, $this->padChar, \STR_PAD_LEFT);
}
private function isOpeningTag(string $part) : bool
{
return \Rector\Core\Util\StringUtils::isMatch($part, self::IS_OPENING_TAG_REGEX);
}
private function isClosingTag(string $part) : bool
{
return \Rector\Core\Util\StringUtils::isMatch($part, self::IS_CLOSING_TAG_REGEX);
}
private function isOpeningCdataTag(string $part) : bool
{
return \strpos($part, '<![CDATA[') !== \false;
}
private function isClosingCdataTag(string $part) : bool
{
return \strpos($part, ']]>') !== \false;
}
}

View File

@ -6,8 +6,6 @@ namespace Rector\FileFormatter\Formatter;
use Rector\Core\ValueObject\Application\File;
use Rector\FileFormatter\Contract\Formatter\FileFormatterInterface;
use Rector\FileFormatter\ValueObject\EditorConfigConfiguration;
use Rector\FileFormatter\ValueObject\Indent;
use Rector\FileFormatter\ValueObjectFactory\EditorConfigConfigurationBuilder;
use RectorPrefix20220527\Symfony\Component\Yaml\Yaml;
/**
* @see \Rector\Tests\FileFormatter\Formatter\YamlFileFormatter\YamlFileFormatterTest
@ -25,10 +23,4 @@ final class YamlFileFormatter implements \Rector\FileFormatter\Contract\Formatte
$newFileContent = \RectorPrefix20220527\Symfony\Component\Yaml\Yaml::dump($yaml, 99, $editorConfigConfiguration->getIndentSize());
$file->changeFileContent($newFileContent);
}
public function createDefaultEditorConfigConfigurationBuilder() : \Rector\FileFormatter\ValueObjectFactory\EditorConfigConfigurationBuilder
{
$editorConfigConfigurationBuilder = new \Rector\FileFormatter\ValueObjectFactory\EditorConfigConfigurationBuilder();
$editorConfigConfigurationBuilder->withIndent(\Rector\FileFormatter\ValueObject\Indent::createSpaceWithSize(2));
return $editorConfigConfigurationBuilder;
}
}

View File

@ -20,7 +20,7 @@ final class EditorConfigConfigurationBuilder
/**
* @var int
*/
private $indentSize = 2;
private $indentSize = 4;
/**
* @var bool
*/
@ -28,17 +28,13 @@ final class EditorConfigConfigurationBuilder
/**
* @param IndentType::* $indentStyle
*/
public function __construct(string $indentStyle = \Rector\FileFormatter\Enum\IndentType::SPACE, int $indentSize = 2, bool $insertFinalNewline = \true)
public function __construct(string $indentStyle = \Rector\FileFormatter\Enum\IndentType::SPACE, int $indentSize = 4, bool $insertFinalNewline = \true)
{
$this->indentStyle = $indentStyle;
$this->indentSize = $indentSize;
$this->insertFinalNewline = $insertFinalNewline;
$this->newLine = \Rector\FileFormatter\ValueObject\NewLine::fromEditorConfig('lf');
}
public static function create() : self
{
return new self();
}
public function withNewLine(\Rector\FileFormatter\ValueObject\NewLine $newLine) : self
{
$this->newLine = $newLine;

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = '64f93c848df1c6c7d8c73ef501ca320e4d9cc212';
public const PACKAGE_VERSION = 'a7e6b685e90d74eeee9bf3346820826d53725f1c';
/**
* @var string
*/
public const RELEASE_DATE = '2022-05-27 15:02:23';
public const RELEASE_DATE = '2022-05-27 15:26:22';
/**
* @var string
*/

2
vendor/autoload.php vendored
View File

@ -9,4 +9,4 @@ if (PHP_VERSION_ID < 50600) {
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit20edb4bb0f3b1e5db5162bdcb994dddb::getLoader();
return ComposerAutoloaderInit36d1e579de49b885aa0af3fcb219e006::getLoader();

View File

@ -2132,7 +2132,6 @@ return array(
'Rector\\FileFormatter\\Exception\\ParseIndentException' => $baseDir . '/packages/FileFormatter/Exception/ParseIndentException.php',
'Rector\\FileFormatter\\FileFormatter' => $baseDir . '/packages/FileFormatter/FileFormatter.php',
'Rector\\FileFormatter\\Formatter\\JsonFileFormatter' => $baseDir . '/packages/FileFormatter/Formatter/JsonFileFormatter.php',
'Rector\\FileFormatter\\Formatter\\XmlFileFormatter' => $baseDir . '/packages/FileFormatter/Formatter/XmlFileFormatter.php',
'Rector\\FileFormatter\\Formatter\\YamlFileFormatter' => $baseDir . '/packages/FileFormatter/Formatter/YamlFileFormatter.php',
'Rector\\FileFormatter\\ValueObjectFactory\\EditorConfigConfigurationBuilder' => $baseDir . '/packages/FileFormatter/ValueObjectFactory/EditorConfigConfigurationBuilder.php',
'Rector\\FileFormatter\\ValueObject\\EditorConfigConfiguration' => $baseDir . '/packages/FileFormatter/ValueObject/EditorConfigConfiguration.php',

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit20edb4bb0f3b1e5db5162bdcb994dddb
class ComposerAutoloaderInit36d1e579de49b885aa0af3fcb219e006
{
private static $loader;
@ -22,19 +22,19 @@ class ComposerAutoloaderInit20edb4bb0f3b1e5db5162bdcb994dddb
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit20edb4bb0f3b1e5db5162bdcb994dddb', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit36d1e579de49b885aa0af3fcb219e006', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit20edb4bb0f3b1e5db5162bdcb994dddb', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit36d1e579de49b885aa0af3fcb219e006', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit20edb4bb0f3b1e5db5162bdcb994dddb::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit36d1e579de49b885aa0af3fcb219e006::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$includeFiles = \Composer\Autoload\ComposerStaticInit20edb4bb0f3b1e5db5162bdcb994dddb::$files;
$includeFiles = \Composer\Autoload\ComposerStaticInit36d1e579de49b885aa0af3fcb219e006::$files;
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire20edb4bb0f3b1e5db5162bdcb994dddb($fileIdentifier, $file);
composerRequire36d1e579de49b885aa0af3fcb219e006($fileIdentifier, $file);
}
return $loader;
@ -46,7 +46,7 @@ class ComposerAutoloaderInit20edb4bb0f3b1e5db5162bdcb994dddb
* @param string $file
* @return void
*/
function composerRequire20edb4bb0f3b1e5db5162bdcb994dddb($fileIdentifier, $file)
function composerRequire36d1e579de49b885aa0af3fcb219e006($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInit20edb4bb0f3b1e5db5162bdcb994dddb
class ComposerStaticInit36d1e579de49b885aa0af3fcb219e006
{
public static $files = array (
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
@ -2501,7 +2501,6 @@ class ComposerStaticInit20edb4bb0f3b1e5db5162bdcb994dddb
'Rector\\FileFormatter\\Exception\\ParseIndentException' => __DIR__ . '/../..' . '/packages/FileFormatter/Exception/ParseIndentException.php',
'Rector\\FileFormatter\\FileFormatter' => __DIR__ . '/../..' . '/packages/FileFormatter/FileFormatter.php',
'Rector\\FileFormatter\\Formatter\\JsonFileFormatter' => __DIR__ . '/../..' . '/packages/FileFormatter/Formatter/JsonFileFormatter.php',
'Rector\\FileFormatter\\Formatter\\XmlFileFormatter' => __DIR__ . '/../..' . '/packages/FileFormatter/Formatter/XmlFileFormatter.php',
'Rector\\FileFormatter\\Formatter\\YamlFileFormatter' => __DIR__ . '/../..' . '/packages/FileFormatter/Formatter/YamlFileFormatter.php',
'Rector\\FileFormatter\\ValueObjectFactory\\EditorConfigConfigurationBuilder' => __DIR__ . '/../..' . '/packages/FileFormatter/ValueObjectFactory/EditorConfigConfigurationBuilder.php',
'Rector\\FileFormatter\\ValueObject\\EditorConfigConfiguration' => __DIR__ . '/../..' . '/packages/FileFormatter/ValueObject/EditorConfigConfiguration.php',
@ -3917,9 +3916,9 @@ class ComposerStaticInit20edb4bb0f3b1e5db5162bdcb994dddb
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit20edb4bb0f3b1e5db5162bdcb994dddb::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit20edb4bb0f3b1e5db5162bdcb994dddb::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit20edb4bb0f3b1e5db5162bdcb994dddb::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit36d1e579de49b885aa0af3fcb219e006::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit36d1e579de49b885aa0af3fcb219e006::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit36d1e579de49b885aa0af3fcb219e006::$classMap;
}, null, ClassLoader::class);
}

View File

@ -2786,12 +2786,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/sabbelasichon\/typo3-rector.git",
"reference": "591a5082869687964711412e8a8f76ccd3e3cc97"
"reference": "a5a13630b2f0d68e9286e8adfb84c001ff3a69de"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/sabbelasichon\/typo3-rector\/zipball\/591a5082869687964711412e8a8f76ccd3e3cc97",
"reference": "591a5082869687964711412e8a8f76ccd3e3cc97",
"url": "https:\/\/api.github.com\/repos\/sabbelasichon\/typo3-rector\/zipball\/a5a13630b2f0d68e9286e8adfb84c001ff3a69de",
"reference": "a5a13630b2f0d68e9286e8adfb84c001ff3a69de",
"shasum": ""
},
"require": {
@ -2811,7 +2811,7 @@
"phpunit\/phpunit": "^9.5",
"rector\/phpstan-rules": "^0.5",
"rector\/rector-generator": "dev-main",
"rector\/rector-src": "dev-main#28fb30f",
"rector\/rector-src": "dev-main#ffd84e6",
"symfony\/console": "^6.0",
"symplify\/coding-standard": "^10.2",
"symplify\/easy-coding-standard": "^10.2",
@ -2821,7 +2821,7 @@
"symplify\/vendor-patches": "^10.2",
"tracy\/tracy": "^2.8"
},
"time": "2022-05-25T23:45:58+00:00",
"time": "2022-05-27T15:24:23+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {
@ -2832,7 +2832,7 @@
]
},
"branch-alias": {
"dev-main": "0.11-dev"
"dev-main": "0.13-dev"
}
},
"installation-source": "dist",

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
*/
final class GeneratedConfig
{
public const EXTENSIONS = array('rector/rector-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 43ca394'), 'rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 4a907ed'), 'rector/rector-generator' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-generator', 'relative_install_path' => '../../rector-generator', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 784271e'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 5853b39'), 'rector/rector-nette' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette', 'relative_install_path' => '../../rector-nette', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 5f84d90'), 'rector/rector-phpoffice' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpoffice', 'relative_install_path' => '../../rector-phpoffice', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main e544f2a'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 28a6025'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 6e0ca50'), 'ssch/typo3-rector' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/ssch/typo3-rector', 'relative_install_path' => '../../../ssch/typo3-rector', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 591a508'));
public const EXTENSIONS = array('rector/rector-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 43ca394'), 'rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 4a907ed'), 'rector/rector-generator' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-generator', 'relative_install_path' => '../../rector-generator', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 784271e'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 5853b39'), 'rector/rector-nette' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette', 'relative_install_path' => '../../rector-nette', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 5f84d90'), 'rector/rector-phpoffice' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpoffice', 'relative_install_path' => '../../rector-phpoffice', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main e544f2a'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 28a6025'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 6e0ca50'), 'ssch/typo3-rector' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/ssch/typo3-rector', 'relative_install_path' => '../../../ssch/typo3-rector', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main a5a1363'));
private function __construct()
{
}

View File

@ -9,8 +9,8 @@ $loader = require_once __DIR__.'/autoload.php';
if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) {
spl_autoload_call('RectorPrefix20220527\AutoloadIncluder');
}
if (!class_exists('ComposerAutoloaderInit20edb4bb0f3b1e5db5162bdcb994dddb', false) && !interface_exists('ComposerAutoloaderInit20edb4bb0f3b1e5db5162bdcb994dddb', false) && !trait_exists('ComposerAutoloaderInit20edb4bb0f3b1e5db5162bdcb994dddb', false)) {
spl_autoload_call('RectorPrefix20220527\ComposerAutoloaderInit20edb4bb0f3b1e5db5162bdcb994dddb');
if (!class_exists('ComposerAutoloaderInit36d1e579de49b885aa0af3fcb219e006', false) && !interface_exists('ComposerAutoloaderInit36d1e579de49b885aa0af3fcb219e006', false) && !trait_exists('ComposerAutoloaderInit36d1e579de49b885aa0af3fcb219e006', false)) {
spl_autoload_call('RectorPrefix20220527\ComposerAutoloaderInit36d1e579de49b885aa0af3fcb219e006');
}
if (!class_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !interface_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !trait_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false)) {
spl_autoload_call('RectorPrefix20220527\Helmich\TypoScriptParser\Parser\AST\Statement');
@ -59,9 +59,9 @@ if (!function_exists('print_node')) {
return \RectorPrefix20220527\print_node(...func_get_args());
}
}
if (!function_exists('composerRequire20edb4bb0f3b1e5db5162bdcb994dddb')) {
function composerRequire20edb4bb0f3b1e5db5162bdcb994dddb() {
return \RectorPrefix20220527\composerRequire20edb4bb0f3b1e5db5162bdcb994dddb(...func_get_args());
if (!function_exists('composerRequire36d1e579de49b885aa0af3fcb219e006')) {
function composerRequire36d1e579de49b885aa0af3fcb219e006() {
return \RectorPrefix20220527\composerRequire36d1e579de49b885aa0af3fcb219e006(...func_get_args());
}
}
if (!function_exists('scanPath')) {

View File

@ -30,7 +30,7 @@
"phpunit\/phpunit": "^9.5",
"rector\/phpstan-rules": "^0.5",
"rector\/rector-generator": "dev-main",
"rector\/rector-src": "dev-main#28fb30f",
"rector\/rector-src": "dev-main#ffd84e6",
"symfony\/console": "^6.0",
"symplify\/coding-standard": "^10.2",
"symplify\/easy-coding-standard": "^10.2",
@ -99,7 +99,7 @@
]
},
"branch-alias": {
"dev-main": "0.11-dev"
"dev-main": "0.13-dev"
}
},
"conflict": {

View File

@ -63,12 +63,12 @@ CODE_SAMPLE
if ('ext_typoscript_constants.txt' === $smartFileInfo->getBasename()) {
return \false;
}
if (\Rector\Testing\PHPUnit\StaticPHPUnitEnvironment::isPHPUnitRun() && \substr_compare($smartFileInfo->getBasename(), 'ext_typoscript_constants.txt', -\strlen('ext_typoscript_constants.txt')) === 0) {
if (!\Rector\Testing\PHPUnit\StaticPHPUnitEnvironment::isPHPUnitRun()) {
return \true;
}
if (\substr_compare($smartFileInfo->getBasename(), 'ext_typoscript_constants.txt', -\strlen('ext_typoscript_constants.txt')) === 0) {
return \false;
}
if (\Rector\Testing\PHPUnit\StaticPHPUnitEnvironment::isPHPUnitRun() && \substr_compare($smartFileInfo->getBasename(), 'ext_typoscript_setup.txt', -\strlen('ext_typoscript_setup.txt')) === 0) {
return \false;
}
return \true;
return \substr_compare($smartFileInfo->getBasename(), 'ext_typoscript_setup.txt', -\strlen('ext_typoscript_setup.txt')) !== 0;
}
}

View File

@ -24,12 +24,9 @@ final class RemoveTypoScriptStatementCollector
if (!isset($this->statementsToBeRemoved[$file->getFilePath()])) {
return \false;
}
foreach ($this->statementsToBeRemoved[$file->getFilePath()] as $sourceLine => $statementToBeRemoved) {
if ($sourceLine === $originalStatement->sourceLine) {
return \true;
}
}
return \false;
$desiredSourceLine = $originalStatement->sourceLine;
$currentFileStatements = $this->statementsToBeRemoved[$file->getFilePath()];
return \array_key_exists($desiredSourceLine, $currentFileStatements);
}
public function reset() : void
{

View File

@ -16,7 +16,7 @@ final class LibFluidContentToLibContentElementRector extends \Ssch\TYPO3Rector\F
{
public function enterNode(\Helmich\TypoScriptParser\Parser\AST\Statement $statement) : void
{
if (!\is_a($statement, \RectorPrefix20220527\Helmich\TypoScriptParser\Parser\AST\NestedAssignment::class) && !\is_a($statement, \RectorPrefix20220527\Helmich\TypoScriptParser\Parser\AST\Operator\Assignment::class)) {
if (!$statement instanceof \RectorPrefix20220527\Helmich\TypoScriptParser\Parser\AST\NestedAssignment && !$statement instanceof \RectorPrefix20220527\Helmich\TypoScriptParser\Parser\AST\Operator\Assignment) {
return;
}
if ('lib.fluidContent' === $statement->object->relativeName) {

View File

@ -174,7 +174,7 @@ final class TypoScriptFileProcessor implements \Ssch\TYPO3Rector\Contract\Proces
if ([] === $typoscriptRectorsWithChange) {
return;
}
$editorConfigConfigurationBuilder = \Rector\FileFormatter\ValueObjectFactory\EditorConfigConfigurationBuilder::create();
$editorConfigConfigurationBuilder = new \Rector\FileFormatter\ValueObjectFactory\EditorConfigConfigurationBuilder();
$editorConfigConfigurationBuilder->withIndent(\Rector\FileFormatter\ValueObject\Indent::createSpaceWithSize(4));
$editorConfiguration = $this->editorConfigParser->extractConfigurationForFile($file, $editorConfigConfigurationBuilder);
$prettyPrinterConfiguration = \RectorPrefix20220527\Helmich\TypoScriptParser\Parser\Printer\PrettyPrinterConfiguration::create();
@ -208,7 +208,7 @@ final class TypoScriptFileProcessor implements \Ssch\TYPO3Rector\Contract\Proces
private function convertToPhpFileRectors() : array
{
return \array_filter($this->typoScriptRectors, function (\RectorPrefix20220527\Helmich\TypoScriptParser\Parser\Traverser\Visitor $visitor) : bool {
return \is_a($visitor, \Ssch\TYPO3Rector\Contract\FileProcessor\TypoScript\ConvertToPhpFileInterface::class, \true);
return $visitor instanceof \Ssch\TYPO3Rector\Contract\FileProcessor\TypoScript\ConvertToPhpFileInterface;
});
}
private function convertTypoScriptToPhpFiles() : void